Skip to content

Misleading statements on Generator::rewind() page #5030

@Krause-a

Description

@Krause-a

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions