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

Breadcrumb

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

function RejectedPromise::then

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

Code

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

API Navigation

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