Skip to content

Commit

Permalink
Updated Rector to commit 0348124a5535b99712da4debc136d2e73647b97a
Browse files Browse the repository at this point in the history
rectorphp/rector-src@0348124 [CodeQuality] Skip Switch_ always returned on ExplicitReturnNullRector (#5800)
  • Loading branch information
TomasVotruba committed Apr 3, 2024
1 parent 6e65fef commit b352c84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion rules/TypeDeclaration/TypeInferer/SilentVoidResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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_;
Expand Down Expand Up @@ -149,8 +150,11 @@ private function isSwitchWithAlwaysReturnOrExit(Switch_ $switch) : bool
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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit b352c84

Please sign in to comment.