function FulfilledPromise::then
Same name in this branch
- 11.1.x vendor/php-http/promise/src/FulfilledPromise.php \Http\Promise\FulfilledPromise::then()
- 11.1.x vendor/guzzlehttp/promises/src/FulfilledPromise.php \GuzzleHttp\Promise\FulfilledPromise::then()
@template TFulfilled
Parameters
?(callable((T is void ? null : T)): (PromiseInterface<TFulfilled>|TFulfilled)) $onFulfilled:
Return value
PromiseInterface<($onFulfilled is null ? T : TFulfilled)>
Overrides PromiseInterface::then
1 call to FulfilledPromise::then()
- FulfilledPromise::finally in vendor/
react/ promise/ src/ Internal/ FulfilledPromise.php - Allows you to execute "cleanup" type tasks in a promise chain.
File
-
vendor/
react/ promise/ src/ Internal/ FulfilledPromise.php, line 37
Class
- FulfilledPromise
- @internal
Namespace
React\Promise\InternalCode
public function then(?callable $onFulfilled = null, ?callable $onRejected = null) : PromiseInterface {
if (null === $onFulfilled) {
return $this;
}
try {
/**
* @var PromiseInterface<T>|T $result
*/
$result = $onFulfilled($this->value);
return resolve($result);
} catch (\Throwable $exception) {
return new RejectedPromise($exception);
}
}