Skip to content

Array undetected as non-empty when in_array is not strict #9662

Description

@villfa

Bug report

PHPStan detects rightfully that an array is non empty whether calling in_array() with it returns true, but only when in_array() is strict.

I think this behaviour should not depend on the strictness of in_array().

Code snippet that reproduces the problem

https://phpstan.org/r/2281baba-6802-4195-af8a-b94dd641cfb6

Expected output

Dumped type should be non-empty-array in both cases.

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

PHPStan is such a great tool. Thank you for your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions