allSettled()
/**
* @throws Throwable
* @param array<int, Async|Promise|callable> $promises
* @phpstan-param array<int, Async|Promise|callable> $promises
*/
public static function allSettled(array $promises): Promise;function testPromise1() : Promise {
return new Promise(function ($resolve, $reject) {
$resolve("A");
});
}
function testPromise2() : Promise {
return new Promise(function ($resolve, $reject) {
$reject("B");
});
}
Promise::allSettled([
testPromise1(),
testPromise2()
])->then(fn($result) => var_dump($promise));Last updated