-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#6837Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/3a082b48-0b5f-4662-b85c-c50ab158a040
<?php
final class switchBreakNotUnreachable {
public function run(): bool {
switch('test') {
case 'test':
if(rand(0, 1)) break;
return false;
default:
return false;
}
return true;
}
}Responsible rules
RemoveUnreachableStatementRector
Expected Behavior
Rector shouldn't touch the code here
Actual Behavior
Rector removes the return true; at the end, even though it's not unreachable, breaking code logic and syntax.
TomasVotruba