rector
rector copied to clipboard
ChangeSwitchToMatchRector eating comment
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/71ea7a79-61c4-44d3-a655-69b385710524
<?php
final class DemoFile
{
public function run(bool $permission): bool
{
switch ($permission) {
case 'VIEW':
return false;
case 'EDIT':
return true;
}
// Comment
return true;
}
}
Responsible rules
-
ChangeSwitchToMatchRector
Expected Behavior
<?php
final class DemoFile
{
public function run(bool $permission): bool
{
return match ($permission) {
'VIEW' => false,
'EDIT' => true,
// Comment
default => true,
};
}
}
}