Documentation

ReactPromiseAdapter
in package
implements PromiseAdapter

Interfaces, Classes, Traits and Enums

PromiseAdapter
Provides a means for integration of async PHP platforms ([related docs](data-fetching.md#async-php))

Table of Contents

all()  : Promise
Given an array of promises (or values), returns a promise that is fulfilled when all the items in the array are fulfilled.
convertThenable()  : Promise
Converts thenable of the underlying platform into GraphQL\Executor\Promise\Promise instance
create()  : Promise
Creates a Promise
createFulfilled()  : Promise
Creates a fulfilled Promise for a value if the value is not a promise.
createRejected()  : Promise
Creates a rejected promise for a reason if the reason is not a promise. If the provided reason is a promise, then it is returned as-is.
isThenable()  : bool
Return true if the value is a promise or a deferred of the underlying platform
then()  : Promise
Accepts our Promise wrapper, extracts adopted promise out of it and executes actual `then` logic described in Promises/A+ specs. Then returns new wrapped instance of GraphQL\Executor\Promise\Promise.

Methods

all()

Given an array of promises (or values), returns a promise that is fulfilled when all the items in the array are fulfilled.

public all(array<string|int, mixed> $promisesOrValues) : Promise
Parameters
$promisesOrValues : array<string|int, mixed>

Promises or values.

Tags
inheritdoc
Return values
Promise

convertThenable()

Converts thenable of the underlying platform into GraphQL\Executor\Promise\Promise instance

public convertThenable(mixed $thenable) : Promise
Parameters
$thenable : mixed
Tags
inheritdoc
Return values
Promise

createFulfilled()

Creates a fulfilled Promise for a value if the value is not a promise.

public createFulfilled([mixed $value = null ]) : Promise
Parameters
$value : mixed = null
Tags
inheritdoc
Return values
Promise

createRejected()

Creates a rejected promise for a reason if the reason is not a promise. If the provided reason is a promise, then it is returned as-is.

public createRejected(mixed $reason) : Promise
Parameters
$reason : mixed
Tags
inheritdoc
Return values
Promise

isThenable()

Return true if the value is a promise or a deferred of the underlying platform

public isThenable(mixed $value) : bool
Parameters
$value : mixed
Tags
inheritdoc
Return values
bool

then()

Accepts our Promise wrapper, extracts adopted promise out of it and executes actual `then` logic described in Promises/A+ specs. Then returns new wrapped instance of GraphQL\Executor\Promise\Promise.

public then(Promise $promise[, callable|null $onFulfilled = null ][, callable|null $onRejected = null ]) : Promise
Parameters
$promise : Promise
$onFulfilled : callable|null = null
$onRejected : callable|null = null
Tags
inheritdoc
Return values
Promise

Search results