提交的内容
This commit is contained in:
35
vendor/guzzlehttp/promises/CHANGELOG.md
vendored
Executable file → Normal file
35
vendor/guzzlehttp/promises/CHANGELOG.md
vendored
Executable file → Normal file
@ -1,6 +1,41 @@
|
||||
# CHANGELOG
|
||||
|
||||
|
||||
## 2.2.0 - 2025-03-27
|
||||
|
||||
### Fixed
|
||||
|
||||
- Revert "Allow an empty EachPromise to be resolved by running the queue"
|
||||
|
||||
|
||||
## 2.1.0 - 2025-03-27
|
||||
|
||||
### Added
|
||||
|
||||
- Allow an empty EachPromise to be resolved by running the queue
|
||||
|
||||
|
||||
## 2.0.4 - 2024-10-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- Once settled, don't allow further rejection of additional promises
|
||||
|
||||
|
||||
## 2.0.3 - 2024-07-18
|
||||
|
||||
### Changed
|
||||
|
||||
- PHP 8.4 support
|
||||
|
||||
|
||||
## 2.0.2 - 2023-12-03
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced `call_user_func*` with native calls
|
||||
|
||||
|
||||
## 2.0.1 - 2023-08-03
|
||||
|
||||
### Changed
|
||||
|
||||
0
vendor/guzzlehttp/promises/LICENSE
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/LICENSE
vendored
Executable file → Normal file
8
vendor/guzzlehttp/promises/README.md
vendored
Executable file → Normal file
8
vendor/guzzlehttp/promises/README.md
vendored
Executable file → Normal file
@ -38,10 +38,10 @@ composer require guzzlehttp/promises
|
||||
|
||||
## Version Guidance
|
||||
|
||||
| Version | Status | PHP Version |
|
||||
|---------|------------------------|--------------|
|
||||
| 1.x | Bug and security fixes | >=5.5,<8.3 |
|
||||
| 2.x | Latest | >=7.2.5,<8.4 |
|
||||
| Version | Status | PHP Version |
|
||||
|---------|---------------------|--------------|
|
||||
| 1.x | Security fixes only | >=5.5,<8.3 |
|
||||
| 2.x | Latest | >=7.2.5,<8.5 |
|
||||
|
||||
|
||||
## Quick Start
|
||||
|
||||
4
vendor/guzzlehttp/promises/composer.json
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/composer.json
vendored
Executable file → Normal file
@ -29,8 +29,8 @@
|
||||
"php": "^7.2.5 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"bamarni/composer-bin-plugin": "^1.8.1",
|
||||
"phpunit/phpunit": "^8.5.29 || ^9.5.23"
|
||||
"bamarni/composer-bin-plugin": "^1.8.2",
|
||||
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
0
vendor/guzzlehttp/promises/src/AggregateException.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/AggregateException.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/CancellationException.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/CancellationException.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/Coroutine.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/Coroutine.php
vendored
Executable file → Normal file
@ -84,8 +84,8 @@ final class Coroutine implements PromiseInterface
|
||||
}
|
||||
|
||||
public function then(
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
return $this->result->then($onFulfilled, $onRejected);
|
||||
}
|
||||
|
||||
0
vendor/guzzlehttp/promises/src/Create.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/Create.php
vendored
Executable file → Normal file
17
vendor/guzzlehttp/promises/src/Each.php
vendored
Executable file → Normal file
17
vendor/guzzlehttp/promises/src/Each.php
vendored
Executable file → Normal file
@ -19,14 +19,12 @@ final class Each
|
||||
* index, and the aggregate promise. The callback can invoke any necessary
|
||||
* side effects and choose to resolve or reject the aggregate if needed.
|
||||
*
|
||||
* @param mixed $iterable Iterator or array to iterate over.
|
||||
* @param callable $onFulfilled
|
||||
* @param callable $onRejected
|
||||
* @param mixed $iterable Iterator or array to iterate over.
|
||||
*/
|
||||
public static function of(
|
||||
$iterable,
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
return (new EachPromise($iterable, [
|
||||
'fulfilled' => $onFulfilled,
|
||||
@ -44,14 +42,12 @@ final class Each
|
||||
*
|
||||
* @param mixed $iterable
|
||||
* @param int|callable $concurrency
|
||||
* @param callable $onFulfilled
|
||||
* @param callable $onRejected
|
||||
*/
|
||||
public static function ofLimit(
|
||||
$iterable,
|
||||
$concurrency,
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
return (new EachPromise($iterable, [
|
||||
'fulfilled' => $onFulfilled,
|
||||
@ -67,12 +63,11 @@ final class Each
|
||||
*
|
||||
* @param mixed $iterable
|
||||
* @param int|callable $concurrency
|
||||
* @param callable $onFulfilled
|
||||
*/
|
||||
public static function ofLimitAll(
|
||||
$iterable,
|
||||
$concurrency,
|
||||
callable $onFulfilled = null
|
||||
?callable $onFulfilled = null
|
||||
): PromiseInterface {
|
||||
return self::ofLimit(
|
||||
$iterable,
|
||||
|
||||
8
vendor/guzzlehttp/promises/src/EachPromise.php
vendored
Executable file → Normal file
8
vendor/guzzlehttp/promises/src/EachPromise.php
vendored
Executable file → Normal file
@ -135,7 +135,7 @@ class EachPromise implements PromisorInterface
|
||||
|
||||
// Add only up to N pending promises.
|
||||
$concurrency = is_callable($this->concurrency)
|
||||
? call_user_func($this->concurrency, count($this->pending))
|
||||
? ($this->concurrency)(count($this->pending))
|
||||
: $this->concurrency;
|
||||
$concurrency = max($concurrency - count($this->pending), 0);
|
||||
// Concurrency may be set to 0 to disallow new promises.
|
||||
@ -170,8 +170,7 @@ class EachPromise implements PromisorInterface
|
||||
$this->pending[$idx] = $promise->then(
|
||||
function ($value) use ($idx, $key): void {
|
||||
if ($this->onFulfilled) {
|
||||
call_user_func(
|
||||
$this->onFulfilled,
|
||||
($this->onFulfilled)(
|
||||
$value,
|
||||
$key,
|
||||
$this->aggregate
|
||||
@ -181,8 +180,7 @@ class EachPromise implements PromisorInterface
|
||||
},
|
||||
function ($reason) use ($idx, $key): void {
|
||||
if ($this->onRejected) {
|
||||
call_user_func(
|
||||
$this->onRejected,
|
||||
($this->onRejected)(
|
||||
$reason,
|
||||
$key,
|
||||
$this->aggregate
|
||||
|
||||
4
vendor/guzzlehttp/promises/src/FulfilledPromise.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/FulfilledPromise.php
vendored
Executable file → Normal file
@ -31,8 +31,8 @@ class FulfilledPromise implements PromiseInterface
|
||||
}
|
||||
|
||||
public function then(
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
// Return itself if there is no onFulfilled function.
|
||||
if (!$onFulfilled) {
|
||||
|
||||
0
vendor/guzzlehttp/promises/src/Is.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/Is.php
vendored
Executable file → Normal file
8
vendor/guzzlehttp/promises/src/Promise.php
vendored
Executable file → Normal file
8
vendor/guzzlehttp/promises/src/Promise.php
vendored
Executable file → Normal file
@ -25,16 +25,16 @@ class Promise implements PromiseInterface
|
||||
* @param callable $cancelFn Fn that when invoked cancels the promise.
|
||||
*/
|
||||
public function __construct(
|
||||
callable $waitFn = null,
|
||||
callable $cancelFn = null
|
||||
?callable $waitFn = null,
|
||||
?callable $cancelFn = null
|
||||
) {
|
||||
$this->waitFn = $waitFn;
|
||||
$this->cancelFn = $cancelFn;
|
||||
}
|
||||
|
||||
public function then(
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
if ($this->state === self::PENDING) {
|
||||
$p = new Promise(null, [$this, 'cancel']);
|
||||
|
||||
4
vendor/guzzlehttp/promises/src/PromiseInterface.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/PromiseInterface.php
vendored
Executable file → Normal file
@ -27,8 +27,8 @@ interface PromiseInterface
|
||||
* @param callable $onRejected Invoked when the promise is rejected.
|
||||
*/
|
||||
public function then(
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface;
|
||||
|
||||
/**
|
||||
|
||||
0
vendor/guzzlehttp/promises/src/PromisorInterface.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/PromisorInterface.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/RejectedPromise.php
vendored
Executable file → Normal file
4
vendor/guzzlehttp/promises/src/RejectedPromise.php
vendored
Executable file → Normal file
@ -31,8 +31,8 @@ class RejectedPromise implements PromiseInterface
|
||||
}
|
||||
|
||||
public function then(
|
||||
callable $onFulfilled = null,
|
||||
callable $onRejected = null
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
): PromiseInterface {
|
||||
// If there's no onRejected callback then just return self.
|
||||
if (!$onRejected) {
|
||||
|
||||
0
vendor/guzzlehttp/promises/src/RejectionException.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/RejectionException.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/TaskQueue.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/TaskQueue.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/TaskQueueInterface.php
vendored
Executable file → Normal file
0
vendor/guzzlehttp/promises/src/TaskQueueInterface.php
vendored
Executable file → Normal file
6
vendor/guzzlehttp/promises/src/Utils.php
vendored
Executable file → Normal file
6
vendor/guzzlehttp/promises/src/Utils.php
vendored
Executable file → Normal file
@ -21,7 +21,7 @@ final class Utils
|
||||
*
|
||||
* @param TaskQueueInterface|null $assign Optionally specify a new queue instance.
|
||||
*/
|
||||
public static function queue(TaskQueueInterface $assign = null): TaskQueueInterface
|
||||
public static function queue(?TaskQueueInterface $assign = null): TaskQueueInterface
|
||||
{
|
||||
static $queue;
|
||||
|
||||
@ -144,7 +144,9 @@ final class Utils
|
||||
$results[$idx] = $value;
|
||||
},
|
||||
function ($reason, $idx, Promise $aggregate): void {
|
||||
$aggregate->reject($reason);
|
||||
if (Is::pending($aggregate)) {
|
||||
$aggregate->reject($reason);
|
||||
}
|
||||
}
|
||||
)->then(function () use (&$results) {
|
||||
ksort($results);
|
||||
|
||||
Reference in New Issue
Block a user