Documentation

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, Promise>|array<string|int, mixed> $promisesOrValues) : Promise
Parameters
$promisesOrValues : array<string|int, Promise>|array<string|int, mixed>

Promises or values.

Return values
Promise

convertThenable()

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

public convertThenable(object $thenable) : Promise
Parameters
$thenable : object
Return values
Promise

create()

Creates a Promise

public create(callable $resolver) : Promise

Expected resolver signature: function(callable $resolve, callable $reject)

Parameters
$resolver : callable
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
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(Throwable $reason) : Promise
Parameters
$reason : Throwable
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
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
Return values
Promise

Search results