diff --git a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php index 2ed454daa60..1c6c5ee9d15 100644 --- a/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php +++ b/rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php @@ -13,6 +13,7 @@ use PhpParser\Node\Expr\YieldFrom; use PhpParser\Node\FunctionLike; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Break_; +use PhpParser\Node\Stmt\Case_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Continue_; use PhpParser\Node\Stmt\Do_; @@ -149,8 +150,11 @@ final class SilentVoidResolver return \false; } $casesWithReturnOrExitCount = $this->resolveReturnOrExitCount($switch); + $cases = \array_filter($switch->cases, static function (Case_ $case) : bool { + return $case->stmts !== []; + }); // has same amount of first return or exit nodes as switches - return \count($switch->cases) === $casesWithReturnOrExitCount; + return \count($cases) === $casesWithReturnOrExitCount; } private function isTryCatchAlwaysReturnOrExit(TryCatch $tryCatch) : bool { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 1d026318384..c5208b34bb7 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 = '88648d1e6fe18bcc67ea76ebdc76c1d1e6d1fe6f'; + public const PACKAGE_VERSION = '0348124a5535b99712da4debc136d2e73647b97a'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-04-03 13:36:35'; + public const RELEASE_DATE = '2024-04-03 21:15:24'; /** * @var int */