Skip to content

Track $arr[$key] existence across array_search/array_find_key #14537

@staabm

Description

@staabm

Bug report

a variable assigned from array_search or array_find_key should infer the proper $array[$key] type when compared later on, similar to how its done in phpstan/phpstan-src#5537

Code snippet that reproduces the problem

https://phpstan.org/r/e9efce03-3662-41f7-bfa7-449aa480f9ba

Expected output

no error

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions