Skip to content

non-empty-array seems to be incorrectly identified as possibly empty after unset #11096

@cfahner

Description

@cfahner

Bug report

A property marked as non-empty-array seems to be incorrectly identified as possibly empty. This is after explicitly checking if the array has at least two items before using unset() on it.

Code snippet that reproduces the problem

https://phpstan.org/r/8d223a39-663d-42ba-803d-1ae7644ded48

Expected output

No errors as the array should have at least one item left.

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

Very happy with PHPStan! Prevented a lot of headaches so far.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions