function RejectedPromise::then
Same name in this branch
- 11.1.x vendor/php-http/promise/src/RejectedPromise.php \Http\Promise\RejectedPromise::then()
- 11.1.x vendor/guzzlehttp/promises/src/RejectedPromise.php \GuzzleHttp\Promise\RejectedPromise::then()
@template TRejected
Parameters
?callable $onFulfilled:
?(callable(\Throwable): (PromiseInterface<TRejected>|TRejected)) $onRejected:
Return value
PromiseInterface<($onRejected is null ? never : TRejected)>
Overrides PromiseInterface::then
2 calls to RejectedPromise::then()
- RejectedPromise::catch in vendor/
react/ promise/ src/ Internal/ RejectedPromise.php - @template TThrowable of \Throwable @template TRejected
- RejectedPromise::finally in vendor/
react/ promise/ src/ Internal/ RejectedPromise.php - Allows you to execute "cleanup" type tasks in a promise chain.
File
-
vendor/
react/ promise/ src/ Internal/ RejectedPromise.php, line 64
Class
- RejectedPromise
- @internal
Namespace
React\Promise\InternalCode
public function then(?callable $onFulfilled = null, ?callable $onRejected = null) : PromiseInterface {
if (null === $onRejected) {
return $this;
}
$this->handled = true;
try {
return resolve($onRejected($this->reason));
} catch (\Throwable $exception) {
return new RejectedPromise($exception);
}
}