diff --git a/rules-tests/Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/multi_next_stmt.php.inc b/rules-tests/Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/multi_next_stmt.php.inc new file mode 100644 index 0000000000..df8ed7e779 --- /dev/null +++ b/rules-tests/Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/multi_next_stmt.php.inc @@ -0,0 +1,46 @@ + +----- + SORT_NUMERIC, + 'string', 'list', 'text' => SORT_NATURAL | SORT_FLAG_CASE, + default => SORT_REGULAR, + }; + } +} + +?> diff --git a/rules/Php80/NodeFactory/MatchArmsFactory.php b/rules/Php80/NodeFactory/MatchArmsFactory.php index f3d421bcbb..5a637f9f6c 100644 --- a/rules/Php80/NodeFactory/MatchArmsFactory.php +++ b/rules/Php80/NodeFactory/MatchArmsFactory.php @@ -33,6 +33,12 @@ public function createFromCondAndExprs(array $condAndExprs): array ]); } + foreach ($matchArms as $matchArm) { + if (is_array($matchArm->conds)) { + $matchArm->conds = array_values($matchArm->conds); + } + } + return $matchArms; } }