promise = new class implements Promise { use Internal\Placeholder { resolve as public; fail as public; } }; } /** * @return \Amp\Promise */ public function promise(): Promise { return $this->promise; } /** * Fulfill the promise with the given value. * * @param mixed $value */ public function resolve($value = null) { $this->promise->resolve($value); } /** * Fails the promise the the given reason. * * @param \Throwable $reason */ public function fail(\Throwable $reason) { $this->promise->fail($reason); } }