Skip to content

Unreachable switch case #767

@lookyman

Description

@lookyman

Summary of a problem or a feature request

It would be great if PHPStan could warn about unreachable case in switch statements.

Code snippet that reproduces the problem

https://phpstan.org/r/78db15fe6bc03244e926868d89e51212

Expected output

Instead of (or in addition to) reporting an undefined variable, report an unreachable case.

This particular example is maybe related to the Constant values milestone, but it could probably be generalized.

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