Skip to content

Switch statement does not narrow down types based on branch conditions #13211

@dmolnarqu

Description

@dmolnarqu

Bug report

Cases that eliminate types and terminate execution should narrow down the type of variable for the code below.

Possibly related to #767

Code snippet that reproduces the problem

https://phpstan.org/r/e84041e1-9ce4-43fb-ac85-c21f39ce1f9a

Expected output

Phpstan should recognize the type as more specific after the type-specifying switch branch.

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