Skip to content

Explicit mixed array becomes implicit in if statement #10559

@uh-zuh

Description

@uh-zuh

Bug report

Array with explicit type:

/** @var mixed[] $arr */

becomes implicit mixed[] after if statement:

if ($arr['key'] > 1) {}

and if there is parameter checkImplicitMixed: true than it reports error:

Cannot cast mixed to string.

Note: There is no way to fully reproduce the issue in the playground because there is no possibility to set parameter checkImplicitMixed: true in it.

Code snippet that reproduces the problem

https://phpstan.org/r/6f6e5ab8-433a-464e-a37e-8ae479c04369

Expected output

No errors

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

It is awesome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions