Skip to content

Variable flagged as "might not be defined" when declared before an exception can be thrown. #4838

@frankdejonge

Description

@frankdejonge

Bug report

When a variable is set in a block that later in the block throws an error, a "variable might not be set" error is raised incorrectly.

Code snippet that reproduces the problem

https://phpstan.org/r/8dbd457d-5547-483e-972c-ff5d32725d20

Expected output

No errors were found.

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