Skip to content

Incorrect array size when using unset #6488

@tjveldhuizen

Description

@tjveldhuizen

Bug report

When I conditionally remove items from an array by using unset(), the possible sizes of the array are incorrect

Code snippet that reproduces the problem

https://phpstan.org/r/b4ad7637-32a2-4df6-b392-84e57180a55b

Expected output

Since the array can have any size >= 0, no error should be detected.

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

Always!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions