Skip to content

Adding elements to empty array in while loop does not result in array being recognized as potentially non-empty for in_array #13705

@oliverklee

Description

@oliverklee

Bug report

In this while loop, PHPStan does not detect that the array gets changed in the loop and then can become non-empty, which results in a false positive.

Code snippet that reproduces the problem

https://phpstan.org/r/8e18ce85-c0ed-41cf-ba69-9849c07af4be

Expected output

No warning.

Did PHPStan help you today? Did it make you happy in any way?

No response

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