Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FulfilledPromise.php

function FulfilledPromise::then

Same name in this branch
  1. 11.1.x vendor/php-http/promise/src/FulfilledPromise.php \Http\Promise\FulfilledPromise::then()
  2. 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\Internal

Code

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);
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal