Skip to content

mixed incorrectly reduced to mixed~string #12930

@mabar

Description

@mabar

Bug report

After upgrade from 2.1.11 to 2.1.12 I am getting a new error. Type mixed is being reduced to mixed~string after conditional exception throw. But the condition is not checking just if the type is string, therefore type reduction should not happen. https://3v4l.org/ZZRTQ

It would be also useful to include the reduced type in error message (same way as \PHPStan\dumpType() does), because currently the error message does not make sense.

- Call to function is_string() with mixed will always evaluate to false.
+ Call to function is_string() with mixed~string will always evaluate to false.

Code snippet that reproduces the problem

https://phpstan.org/r/ae539277-b604-4b6c-a09f-b4454daae7f7

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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions