ChangeSwitchToMatchRector fails to parse a switch() #8937
Description
This is maybe similar to #8889 ?
[ERROR] Could not process "xxxxx" file, due to:
"System error: "PhpParser\PrettyPrinterAbstract::p(): Argument #1 ($node) must be of type PhpParser\Node, null
given, called in vendor/rector/rector/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php612"
Run Rector with "--debug" option and post the report here: /~https://github.com/rectorphp/rector/issues/new". On line: 571
It also says $node shouldn't be null.
I've found the line where it errors on and it has to do with a switch case and the change switch to match rector (ChangeSwitchToMatchRector
)
switch($something)
{
case 'number':
case 'percentage':
case 'integer':
case 'price':
case 'decimal':
$sort = SORT_NUMERIC;
break;
case 'string':
case 'list':
case 'text':
$sort = SORT_NATURAL | SORT_FLAG_CASE;
break;
default:
$sort = SORT_REGULAR;
}
When removing the "default" clause, rector works again.
I recreated the switch case on the demo: https://getrector.com/demo/1d270752-64b2-42a8-aacc-f874eb294689
Using version 2.0.3