function Promise::waitIfPending
1 call to Promise::waitIfPending()
- Promise::wait in vendor/
guzzlehttp/ promises/ src/ Promise.php - Waits until the promise completes if possible.
File
-
vendor/
guzzlehttp/ promises/ src/ Promise.php, line 222
Class
- Promise
- Promises/A+ implementation that avoids recursion when possible.
Namespace
GuzzleHttp\PromiseCode
private function waitIfPending() : void {
if ($this->state !== self::PENDING) {
return;
}
elseif ($this->waitFn) {
$this->invokeWaitFn();
}
elseif ($this->waitList) {
$this->invokeWaitList();
}
else {
// If there's no wait function, then reject the promise.
$this->reject('Cannot wait on a promise that has ' . 'no internal wait function. You must provide a wait ' . 'function when constructing the promise to be able to ' . 'wait on a promise.');
}
Utils::queue()->run();
/** @psalm-suppress RedundantCondition */
if ($this->state === self::PENDING) {
$this->reject('Invoking the wait callback did not resolve the promise');
}
}