executor = $executor; SyncPromiseQueue::enqueue(function (): void { $executor = $this->executor; assert($executor !== null, 'Always set in constructor, this callback runs only once.'); $this->executor = null; try { $this->resolve($executor()); } catch (\Throwable $e) { $this->reject($e); } }); } /** * Alias for __construct. * * @param Executor $executor * * @deprecated TODO remove in next major version, use new Deferred() instead */ public static function create(callable $executor): self { return new self($executor); } }