From 158598c999bfa8941264d90150f4ef8e63c0bfa4 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 20 Aug 2025 23:47:12 +0700 Subject: [PATCH] Clean up ternary on ColonAfterSwitchCaseRector --- .../Rector/Switch_/ColonAfterSwitchCaseRector.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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;