diff --git a/src/functions.php b/src/functions.php index e63b715..db9e89a 100644 --- a/src/functions.php +++ b/src/functions.php @@ -231,6 +231,15 @@ function ($reason, $idx, Promise $aggregate) { )->then(function () use (&$results) { ksort($results); return $results; + })->then(function ($results) use ($recursive, &$promises) { + if (true === $recursive && !$promises instanceof \Generator) { + foreach ($promises AS $promise) { + if (\GuzzleHttp\Promise\PromiseInterface::PENDING === $promise->getState()) { + return all($promises, $recursive); + } + } + } + return $results; }); if (true === $recursive) {