Automattic\WooCommerce\Vendor\GraphQL\Executor\Promise\Adapter

SyncPromiseAdapter::convertThenablepublicWC 1.0

Method of the class: SyncPromiseAdapter{}

No Hooks.

Returns

null. Nothing (null).

Usage

$SyncPromiseAdapter = new SyncPromiseAdapter();
$SyncPromiseAdapter->convertThenable( $thenable ): Promise;
$thenable(required)
.

SyncPromiseAdapter::convertThenable() code WC 10.9.1

public function convertThenable($thenable): Promise
{
    if (! $thenable instanceof SyncPromise) {
        // End-users should always use Deferred, not SyncPromise directly
        $deferredClass = Deferred::class;
        $safeThenable = Utils::printSafe($thenable);
        throw new InvariantViolation("Expected instance of {$deferredClass}, got {$safeThenable}.");
    }

    return new Promise($thenable, $this);
}