v1.1.4
This commit is contained in:
parent
d6e6011c3d
commit
1dd5809016
1 changed files with 21760 additions and 3778 deletions
25
vendor/guzzlehttp/promises/src/EachPromise.php
vendored
25
vendor/guzzlehttp/promises/src/EachPromise.php
vendored
|
|
@ -57,6 +57,18 @@ class EachPromise implements PromisorInterface
|
|||
*/
|
||||
public function __construct($iterable, array $config = [])
|
||||
{
|
||||
if (!is_iterable($iterable)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/promises',
|
||||
'2.5',
|
||||
'Passing a non-iterable to %s::%s() is deprecated; guzzlehttp/promises 3.0 will require an iterable.',
|
||||
__CLASS__,
|
||||
__FUNCTION__
|
||||
);
|
||||
|
||||
$iterable = [$iterable];
|
||||
}
|
||||
|
||||
$this->iterable = Create::iterFor($iterable);
|
||||
|
||||
if (isset($config['concurrency'])) {
|
||||
|
|
@ -84,6 +96,19 @@ class EachPromise implements PromisorInterface
|
|||
/** @psalm-assert Promise $this->aggregate */
|
||||
$this->iterable->rewind();
|
||||
$this->refillPending();
|
||||
if (!$this->pending) {
|
||||
Utils::queue()->add(function (): void {
|
||||
if (!$this->aggregate || Is::settled($this->aggregate)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->checkIfFinished();
|
||||
} catch (\Throwable $e) {
|
||||
$this->aggregate->reject($e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$this->aggregate->reject($e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue