Skip to content

Array shape comparing doesn't work properly when narrowed from mixed #7156

@fluffycondor

Description

@fluffycondor

Bug report

PHPStan 1.6.2

If a variable is narrowed from mixed to a shaped array, PHPStan fails to compare it properly.
https://phpstan.org/r/8273475b-6e96-4e2d-baa0-7a0fea921fc0
The same code doesn't yield any errors if I just replace mixed with array:
https://phpstan.org/r/98b21779-1265-465e-ab65-0967bf6feb8f

Code snippet that reproduces the problem

https://phpstan.org/r/8273475b-6e96-4e2d-baa0-7a0fea921fc0

Expected output

No errors.

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

❤️ ❤️ ❤️

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