Skip to content

Top-level break statement breaks the analysis #13790

@claudepache

Description

@claudepache

Bug report

While exploring how good is PHPStan in reporting incorrect uses of break statements, I stumbled on what is perhaps the shortest way to break the analysis:

<?php break;

The following one also prevents PHPStan from continuing its work:

<?php continue;

Code snippet that reproduces the problem

https://phpstan.org/r/73566359-1665-45c8-ad24-7d473e34814a

Expected output

The following error: Keyword break used outside of a loop or a switch statement.

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