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

Breadcrumb

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

function Promise::then

Same name in this branch
  1. 11.1.x vendor/react/promise/src/Promise.php \React\Promise\Promise::then()
  2. 11.1.x vendor/php-http/guzzle7-adapter/src/Promise.php \Http\Adapter\Guzzle7\Promise::then()
  3. 11.1.x vendor/guzzlehttp/promises/src/Promise.php \GuzzleHttp\Promise\Promise::then()

Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).

If you do not care about one of the cases, you can set the corresponding callable to null The callback will be called when the value arrived and never more than once.

Parameters

callable|null $onFulfilled called when a response will be available:

callable|null $onRejected called when an exception occurs:

Return value

Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)

5 methods override Promise::then()
FulfilledPromise::then in vendor/php-http/promise/src/FulfilledPromise.php
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
HttpFulfilledPromise::then in vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
HttpRejectedPromise::then in vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
Promise::then in vendor/php-http/guzzle7-adapter/src/Promise.php
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
RejectedPromise::then in vendor/php-http/promise/src/RejectedPromise.php
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).

File

vendor/php-http/promise/src/Promise.php, line 44

Class

Promise
Promise represents a value that may not be available yet, but will be resolved at some point in future. It acts like a proxy to the actual value.

Namespace

Http\Promise

Code

public function then(?callable $onFulfilled = null, ?callable $onRejected = null);

API Navigation

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