diff --git a/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php b/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php index 6cdacd3613e..02a7dfbe389 100644 --- a/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php +++ b/rules/Php85/Rector/Switch_/ColonAfterSwitchCaseRector.php @@ -65,13 +65,13 @@ public function refactor(Node $node): ?Node continue; } - $startCaseStmtsPos = count($case->stmts) === 0 - ? ( - isset($node->cases[$key + 1]) + if (count($case->stmts) === 0) { + $startCaseStmtsPos = isset($node->cases[$key + 1]) ? $node->cases[$key + 1]->getStartTokenPos() - : $node->getEndTokenPos() - ) - : $case->stmts[0]->getStartTokenPos(); + : $node->getEndTokenPos(); + } else { + $startCaseStmtsPos = $case->stmts[0]->getStartTokenPos(); + } if ($startCaseStmtsPos < 0) { continue;