Link Search Menu Expand Document


Back to index

Author: Daniil Gentili

Creates a promise from a generator function yielding promises.

When a promise is yielded, execution of the generator is interrupted until the promise is resolved. A success value is sent into the generator, while a failure reason is thrown into the generator. Using a coroutine, asynchronous code can be written without callbacks and be structured like synchronous code.

Method list:

  • fail(\Throwable $reason): void
  • offsetGet(mixed $offset): \Amp\Promise
  • getTrace(): array
  • getFrame(): array
  • jsonSerialize(): string
  • onResolve()


fail(\Throwable $reason): void


  • $reason: \Throwable Failure reason.

See also:

  • \Throwable

offsetGet(mixed $offset): \Amp\Promise

Get data at an array offset asynchronously.


  • $offset: mixed Offset

See also:

  • \Amp\Promise

getTrace(): array

Get current stack trace for running coroutine.

getFrame(): array

Get current execution frame.

jsonSerialize(): string



Generated by danog/phpdoc