Skip to content

Report for loops overwriting variables from parent scope (a la foreach) #98

@dktapps

Description

@dktapps

https://phpstan.org/r/8f361ed5-7e15-4ffc-a6b0-3b5c33a3b419

PhpStorm complains about code like this, because an argument is being overwritten by a loop, which might not be intended behaviour.

I found it strange that overwriting from foreach context is reported, but not from for context.

Is there a reason for this not being reported, or just a missing feature?

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