| Server IP : 62.60.133.156 / Your IP : 216.73.217.51 Web Server : LiteSpeed System : Linux linux24.centraldnserver.com 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : mimradmin ( 1166) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, exec, popen, proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/wp-content/plugins/woocommerce/lib/packages/GraphQL/Executor/Promise/ |
Upload File : |
<?php declare(strict_types=1);
namespace Automattic\WooCommerce\Vendor\GraphQL\Executor\Promise;
use Amp\Future as AmpFuture;
use Amp\Promise as AmpPromise;
use Automattic\WooCommerce\Vendor\GraphQL\Error\InvariantViolation;
use Automattic\WooCommerce\Vendor\GraphQL\Executor\Promise\Adapter\SyncPromise;
use React\Promise\PromiseInterface as ReactPromise;
/**
* Convenience wrapper for promises represented by Promise Adapter.
*/
class Promise
{
/** @var SyncPromise|ReactPromise<mixed>|AmpFuture<mixed>|AmpPromise<mixed> */
public $adoptedPromise;
private PromiseAdapter $adapter;
/**
* @param mixed $adoptedPromise
*
* @throws InvariantViolation
*/
public function __construct($adoptedPromise, PromiseAdapter $adapter)
{
if ($adoptedPromise instanceof self) {
$selfClass = self::class;
throw new InvariantViolation("Expected promise from adapted system, got {$selfClass}.");
}
$this->adoptedPromise = $adoptedPromise;
$this->adapter = $adapter;
}
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
{
return $this->adapter->then($this, $onFulfilled, $onRejected);
}
}