awaitable = new Promise(function (callable $resolve, callable $fail) { $this->resolve = $resolve; $this->fail = $fail; }); } /** * @return \Interop\Async\Awaitable */ public function getAwaitable() { return $this->awaitable; } /** * Fulfill the awaitable with the given value. * * @param mixed $value */ public function resolve($value = null) { $resolve = $this->resolve; $resolve($value); } /** * Fails the awaitable the the given reason. * * @param \Throwable|\Exception $reason */ public function fail($reason) { $fail = $this->fail; $fail($reason); } } } } catch (\AssertionError $exception) { goto development; // zend.assertions=1 and assert.exception=1, use development definition. }