From 4be56b36404c60c9cd907c5874b37aa07d929dd6 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 11 Mar 2024 11:19:03 +0000 Subject: [PATCH] Updated Rector to commit a775c65eeccc0c6ed106adbe836ab114f37c5da4 https://github.com/rectorphp/rector-src/commit/a775c65eeccc0c6ed106adbe836ab114f37c5da4 [CodeQuality] Skip throw after foreach with return in loop on SimplifyForeachToCoalescingRector (#5714) --- .../Rector/Foreach_/SimplifyForeachToCoalescingRector.php | 7 ++++--- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php index 8e77d27433a..09a41657e73 100644 --- a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php @@ -88,15 +88,16 @@ CODE_SAMPLE 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 0d3955dce71..193753e17ec 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 */