Skip to content

array_pop() in a loop is wrongly narrowing type to empty array #10666

@mvorisek

Description

@mvorisek

Bug report

https://phpstan.org/r/aad79e4f-cad2-4fe3-8248-9d94ceb5b4d4 - dumped type after array_pop() is ok, but when the array_pop() call is removed, the issue is gone. The issue is somewhere in "loop analysis".

Code snippet that reproduces the problem

https://phpstan.org/r/2524a9ad-a173-4c47-8ddf-734b1dcaff0a

Expected output

no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions