From 6fb335218969eb244abc2e0c1ddbadff89b9e03c Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 7 Apr 2024 09:15:50 +0000 Subject: [PATCH] Updated Rector to commit 690fe892750028e239a01f1b13cd252359994522 https://github.com/rectorphp/rector-src/commit/690fe892750028e239a01f1b13cd252359994522 [CodeQuality] Skip Always return in try catch with finally on ExplicitReturnNullRector (#5807) --- .../TypeInferer/SilentVoidResolver.php | 13 +++++++++---- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php index af8d9a58273..9ca81672897 100644 --- a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php +++ b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php @@ -158,15 +158,20 @@ final class SilentVoidResolver } private function isTryCatchAlwaysReturnOrExit(TryCatch $tryCatch) : bool { + $hasReturnOrExitInFinally = $tryCatch->finally instanceof Finally_ && $this->hasStmtsAlwaysReturnOrExit($tryCatch->finally->stmts); if (!$this->hasStmtsAlwaysReturnOrExit($tryCatch->stmts)) { - return \false; + return $hasReturnOrExitInFinally; } foreach ($tryCatch->catches as $catch) { - if (!$this->hasStmtsAlwaysReturnOrExit($catch->stmts)) { - return \false; + if ($this->hasStmtsAlwaysReturnOrExit($catch->stmts)) { + continue; } + if ($hasReturnOrExitInFinally) { + continue; + } + return \false; } - return !($tryCatch->finally instanceof Finally_ && !$this->hasStmtsAlwaysReturnOrExit($tryCatch->finally->stmts)); + return \true; } private function resolveReturnOrExitCount(Switch_ $switch) : int { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 945dd271c0c..763060eb071 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 = '145b616765b9c534e5ebe4203caa0c0f4dd3b7fc'; + public const PACKAGE_VERSION = '690fe892750028e239a01f1b13cd252359994522'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-04-07 00:29:00'; + public const RELEASE_DATE = '2024-04-07 16:13:24'; /** * @var int */