Generator
final class Generator implements Iterator (View source)
Generator objects are returned from generators, cannot be instantiated via new.
Methods
Throws an exception if the generator is currently after the first yield.
Returns false if the generator has been closed, true otherwise.
Returns whatever was passed to yield or null if nothing was passed or the generator is already closed.
Returns the yielded key or, if none was specified, an auto-incrementing key or null if the generator is already closed.
Resumes the generator (unless the generator is already closed).
Sets the return value of the yield expression and resumes the generator (unless the generator is already closed).
Throws an exception at the current suspension point in the generator.
Returns whatever was passed to return or null if nothing.
Serialize callback Throws an exception as generators can't be serialized.
No description
Details
void
rewind()
Throws an exception if the generator is currently after the first yield.
bool
valid()
Returns false if the generator has been closed, true otherwise.
mixed
current()
Returns whatever was passed to yield or null if nothing was passed or the generator is already closed.
mixed
key()
Returns the yielded key or, if none was specified, an auto-incrementing key or null if the generator is already closed.
void
next()
Resumes the generator (unless the generator is already closed).
mixed
send(mixed $value)
Sets the return value of the yield expression and resumes the generator (unless the generator is already closed).
mixed
PS_UNRESERVE_PREFIX_throw(Throwable $exception)
Throws an exception at the current suspension point in the generator.
mixed
getReturn()
Returns whatever was passed to return or null if nothing.
Throws an exception if the generator is still valid.
void
__wakeup()
Serialize callback Throws an exception as generators can't be serialized.
array
__debugInfo()
No description