Skip to content

return type and hasOffset array shape #6552

@staabm

Description

@staabm

Bug report

phpstan already knows about the offsets a array has after certain checks, e.g. array_key_exists.
this knowledge should be used for the return-type inference.

Code snippet that reproduces the problem

https://phpstan.org/r/46e25e3e-20dd-4248-ab74-7ee32e73bbf2

Expected output

no error

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