mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 879feb8931f1465fa463d539e9ce99ebfae4e948
879feb8931
[CodeQuality] Handle do { } while maybe returned on ExplicitReturnNullRector (#5766)
This commit is contained in:
parent
e14c8a528b
commit
52addb1dde
|
@ -12,7 +12,9 @@ use PhpParser\Node\Expr\Yield_;
|
|||
use PhpParser\Node\Expr\YieldFrom;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Break_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Continue_;
|
||||
use PhpParser\Node\Stmt\Do_;
|
||||
use PhpParser\Node\Stmt\Else_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
|
@ -90,12 +92,21 @@ final class SilentVoidResolver
|
|||
if ($this->isIfReturn($stmt)) {
|
||||
return \true;
|
||||
}
|
||||
if ($stmt instanceof Do_ && $this->hasStmtsAlwaysReturnOrExit($stmt->stmts)) {
|
||||
if ($stmt instanceof Do_ && $this->isDoWithAlwaysReturnOrExit($stmt)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function isDoWithAlwaysReturnOrExit(Do_ $do) : bool
|
||||
{
|
||||
if (!$this->hasStmtsAlwaysReturnOrExit($do->stmts)) {
|
||||
return \false;
|
||||
}
|
||||
return !(bool) $this->betterNodeFinder->findFirst($do->stmts, static function (Node $node) : bool {
|
||||
return $node instanceof Break_ || $node instanceof Continue_;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt|\PhpParser\Node\Expr $stmt
|
||||
*/
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'aac889be3d845974d3ab924ff7ad22784b9e3cb5';
|
||||
public const PACKAGE_VERSION = '879feb8931f1465fa463d539e9ce99ebfae4e948';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-03-23 23:47:25';
|
||||
public const RELEASE_DATE = '2024-03-23 20:30:55';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue