diff --git a/src/promise/Promise.php b/src/promise/Promise.php index 0def7e60523..27a5e50aab8 100644 --- a/src/promise/Promise.php +++ b/src/promise/Promise.php @@ -69,16 +69,17 @@ public function isResolved() : bool{ * * @phpstan-template TPromiseValue * @phpstan-template TKey of array-key - * @phpstan-param non-empty-array> $promises + * @phpstan-param array> $promises * * @phpstan-return Promise> */ public static function all(array $promises) : Promise{ - if(count($promises) === 0){ - throw new \InvalidArgumentException("At least one promise must be provided"); - } /** @phpstan-var PromiseResolver> $resolver */ $resolver = new PromiseResolver(); + if(count($promises) === 0){ + $resolver->resolve([]); + return $resolver->getPromise(); + } $values = []; $toResolve = count($promises); $continue = true;