PromiseInterface
                
            in
            
        
    
        
        
    Tags
Table of Contents
Methods
- always() : PromiseInterface<string|int, T>
- [Deprecated] Allows you to execute "cleanup" type tasks in a promise chain.
- cancel() : void
- The `cancel()` method notifies the creator of the promise that there is no further interest in the results of the operation.
- catch() : PromiseInterface<string|int, T|TRejected>
- Registers a rejection handler for promise. It is a shortcut for:
- finally() : PromiseInterface<string|int, T>
- Allows you to execute "cleanup" type tasks in a promise chain.
- otherwise() : PromiseInterface<string|int, T|TRejected>
- [Deprecated] Registers a rejection handler for a promise.
- then() : PromiseInterface<string|int, mixed>
- Transforms a promise's value by applying a function to the promise's fulfillment or rejection value. Returns a new promise for the transformed result.
Methods
always()
[Deprecated] Allows you to execute "cleanup" type tasks in a promise chain.
    public
                    always(
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(): Array $onFulfilledOrRejected) : PromiseInterface<string|int, T>
    This method continues to exist only for BC reasons and to ease upgrading between versions. It is an alias for:
$promise->finally($onFulfilledOrRejected);
Parameters
- $onFulfilledOrRejected : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(): Array
Tags
Return values
PromiseInterface<string|int, T>cancel()
The `cancel()` method notifies the creator of the promise that there is no further interest in the results of the operation.
    public
                    cancel() : void
    Once a promise is settled (either fulfilled or rejected), calling cancel() on
a promise has no effect.
catch()
Registers a rejection handler for promise. It is a shortcut for:
    public
                    catch(
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(TThrowable): Array $onRejected) : PromiseInterface<string|int, T|TRejected>
    $promise->then(null, $onRejected);
Additionally, you can type hint the $reason argument of $onRejected to catch
only specific errors.
Parameters
- $onRejected : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(TThrowable): Array
Tags
Return values
PromiseInterface<string|int, T|TRejected>finally()
Allows you to execute "cleanup" type tasks in a promise chain.
    public
                    finally(
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(): Array $onFulfilledOrRejected) : PromiseInterface<string|int, T>
    It arranges for $onFulfilledOrRejected to be called, with no arguments,
when the promise is either fulfilled or rejected.
- If $promisefulfills, and$onFulfilledOrRejectedreturns successfully,$newPromisewill fulfill with the same value as$promise.
- If $promisefulfills, and$onFulfilledOrRejectedthrows or returns a rejected promise,$newPromisewill reject with the thrown exception or rejected promise's reason.
- If $promiserejects, and$onFulfilledOrRejectedreturns successfully,$newPromisewill reject with the same reason as$promise.
- If $promiserejects, and$onFulfilledOrRejectedthrows or returns a rejected promise,$newPromisewill reject with the thrown exception or rejected promise's reason.
finally() behaves similarly to the synchronous finally statement. When combined
with catch(), finally() allows you to write code that is similar to the familiar
synchronous catch/finally pair.
Consider the following synchronous code:
try {
    return doSomething();
} catch(\Exception $e) {
    return handleError($e);
} finally {
    cleanup();
}
Similar asynchronous code (with doSomething() that returns a promise) can be
written:
return doSomething()
    ->catch('handleError')
    ->finally('cleanup');
Parameters
- $onFulfilledOrRejected : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(): Array
Return values
PromiseInterface<string|int, T>otherwise()
[Deprecated] Registers a rejection handler for a promise.
    public
                    otherwise(
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(TThrowable): Array $onRejected) : PromiseInterface<string|int, T|TRejected>
    This method continues to exist only for BC reasons and to ease upgrading between versions. It is an alias for:
$promise->catch($onRejected);
Parameters
- $onRejected : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(TThrowable): Array
Tags
Return values
PromiseInterface<string|int, T|TRejected>then()
Transforms a promise's value by applying a function to the promise's fulfillment or rejection value. Returns a new promise for the transformed result.
    public
                    then([
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(mixed): Array|null $onFulfilled = null ][, 
Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78
callable(Throwable): Array|null $onRejected = null ]) : PromiseInterface<string|int, mixed>
    The then() method registers new fulfilled and rejection handlers with a promise
(all parameters are optional):
- 
$onFulfilledwill be invoked once the promise is fulfilled and passed the result as the first argument.
- 
$onRejectedwill be invoked once the promise is rejected and passed the reason as the first argument.
It returns a new promise that will fulfill with the return value of either
$onFulfilled or $onRejected, whichever is called, or will reject with
the thrown exception if either throws.
A promise makes the following guarantees about handlers registered in
the same call to then():
- Only one of $onFulfilledor$onRejectedwill be called, never both.
- 
$onFulfilledand$onRejectedwill never be called more than once.
Parameters
- $onFulfilled : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(mixed): Array|null = null
- $onRejected : Warning: Array to string conversion in /opt/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(Throwable): Array|null = null