$gen * @return Promise */ function coroutine(callable $gen) : Promise {} /** * @template TReturn * @param callable():(\Generator|null) $gen * @return Promise */ function call(callable $gen) : Promise {} /** * @template TReturn */ interface Promise { /** * @param callable(\Throwable|null $exception, TReturn|null $result):void * @return void */ function onResolve(callable $onResolved); } /** * @template TReturn * * @template-implements Promise */ class Success implements Promise { /** * @param callable(\Throwable|null $exception, TReturn|null $result):void * @return void */ function onResolve(callable $onResolved) {} }