doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

Misleading statements on Generator::rewind() page

Open Krause-a opened this issue 1 month ago • 0 comments

From manual page: https://php.net/generator.rewind


The documentation for Generator::rewind() can be misleading. It suggests that rewind() always resets the generator, but in practice it only executes up to the first yield and may throw an Exception if execution has already passed a yield.

Looking over the function name and short description really made me feel like I had a fundamental hole in my understanding of how generators work. After running many test cases, that turned out to be a false alarm. It was just that the docs are really misleading.

Krause-a avatar Dec 05 '25 23:12 Krause-a