Automattic\WooCommerce\Vendor\GraphQL\Executor

ReferenceExecutor::getPromiseprotectedWC 1.0

Only returns the value if it acts like a Promise, i.e. has a "then" function, otherwise returns null.

Method of the class: ReferenceExecutor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->getPromise( $value ): ?Promise;
$value(mixed) (required)
.

ReferenceExecutor::getPromise() code WC 10.9.1

protected function getPromise($value): ?Promise
{
    if ($value === null || $value instanceof Promise) {
        return $value;
    }

    $promiseAdapter = $this->exeContext->promiseAdapter;
    if ($promiseAdapter->isThenable($value)) {
        return $promiseAdapter->convertThenable($value);
    }

    return null;
}