Skip to content

"Unreachable statement" false positive for html whitespace after throw #7531

@cronfy

Description

@cronfy

Bug report

Using throw in a html template with alternate control structure syntax indented with whitespace after throw leads to "Unreachable statement" false positive after throw.

If spaces after throw are removed, no error is raised.

Code snippet that reproduces the problem

https://phpstan.org/r/8e135be5-b23e-4df0-b4ee-aa34ed4ddd6d - try to remove spaces before <?php endif ?>, and the error goes away.

Expected output

No error is raised.

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

Yes, it has just found another bug in my code that otherwise would be very tricky to catch! ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions