Skip to content

Regression: variable definition inside match() no longer recognized #9474

@dktapps

Description

@dktapps

Bug report

If a variable is defined inside match like match($var = something()), this variable is able to be used inside the switch, but since PHPStan 1.10.20, this no longer works correctly, as seen here: https://github.com/pmmp/PocketMine-MP/actions/runs/5333226570/jobs/9663426460?pr=5849

Code snippet that reproduces the problem

https://phpstan.org/r/354f6b51-4a21-4db1-83a4-dc8098bee27a

Expected output

No error should be reported: this is valid working code.

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

No response

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