diff --git a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php index 8e77d27433ae..09a41657e73e 100644 --- a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php @@ -88,15 +88,16 @@ public function refactor(Node $node) : ?Node return null; } $nextStmt = $node->stmts[$key + 1] ?? null; + if (!$nextStmt instanceof Return_) { + continue; + } $return = $this->processForeachNodeWithReturnInside($foreach, $foreachReturnOrAssign, $nextStmt); if (!$return instanceof Return_) { continue; } $node->stmts[$key] = $return; // cleanup next return - if ($nextStmt instanceof Return_) { - unset($node->stmts[$key + 1]); - } + unset($node->stmts[$key + 1]); $hasChanged = \true; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 0d3955dce71c..193753e17ecf 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '01c460ee526f057b6a4d48835ac19536a857c347'; + public const PACKAGE_VERSION = 'a775c65eeccc0c6ed106adbe836ab114f37c5da4'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-03-11 12:28:16'; + public const RELEASE_DATE = '2024-03-11 18:16:44'; /** * @var int */