Skip to content

"Match arm is unreachable" false positive when using union of enums #11313

@Jean85

Description

@Jean85

Bug report

Mixing two enums in a single match seems to create some confusion, and generates a false positive in the unreachable checks.

It seems to have issues with an union of enums, but if I reduce the enum to a single case it doesn't reproduce (because it probably simplifies it internally to a literal?).

Code snippet that reproduces the problem

https://phpstan.org/r/050771ee-36f5-498b-b35e-e68b8b841e9f

Expected output

No issues

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

Totally, it's helping me everyday!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions