HH\AsyncGenerator::send

Send a value to the async generator and resumes execution of the generator.

Description

public function send(
  ?Ts $v,
): Awaitable<?tuple>

Send a value to the async generator and resumes execution of the generator.

You should always await the returned Awaitable to get the actual key/value tuple.

If null is returned, that means you have reached the end of iteration.

You cannot call send() without having the value returned from a previous call to send(), next(), raise(), having first awaited.

If you pass null to send(), that is equivalent to calling next(), but you still need an initial next() call before calling send(null).

Parameters

  • ?Ts $v - The value to send to the async generator.

Return Values

  • Awaitable<?tuple> - The Awaitable that produced the yielded key/value tuple in the generator. What is returned is a tuple or null.