Skip to content

Allow processing unreachable statements after an unused label - #7103

Open
samsonasik wants to merge 1 commit into
phpstan:2.3.xfrom
samsonasik:unreacahble-label
Open

samsonasik wants to merge 1 commit into
phpstan:2.3.xfrom
samsonasik:unreacahble-label

Conversation

@samsonasik

@samsonasik samsonasik commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

/cc @TomasVotruba @hmennen90 if this is accepted, this should hopefully will allow us to close unnecessary tweak on rector-src side:

This PR makes PHPStan emit UnreachableStatementNode for the statements that follow an unused label when the code above the label always terminates.

goto end;
lbl:
$a = array(1); // never walked, and no UnreachableStatementNode emitted
end:

@samsonasik

Copy link
Copy Markdown
Contributor Author

@ondrejmirtes ready for review 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant