Updated Rector to commit bf5270a8456ec1c6e45bbcaa8ad2aab6b5a4dfb6

bf5270a845 [CodeQuality] Handle crash first class callable on If/Elseif cond on OptionalParametersAfterRequiredRector (#6555)
This commit is contained in:
Tomas Votruba 2024-12-11 17:11:01 +00:00
parent be33c47b56
commit c29f55fcfa
2 changed files with 11 additions and 2 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '33d12b758ef5726ae7cc174ef7fcac627cc71dea';
public const PACKAGE_VERSION = 'bf5270a8456ec1c6e45bbcaa8ad2aab6b5a4dfb6';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-12-11 23:43:12';
public const RELEASE_DATE = '2024-12-12 00:08:37';
/**
* @var int
*/

View File

@ -63,7 +63,9 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Do_;
use PhpParser\Node\Stmt\Echo_;
use PhpParser\Node\Stmt\ElseIf_;
use PhpParser\Node\Stmt\Enum_;
use PhpParser\Node\Stmt\EnumCase;
use PhpParser\Node\Stmt\Expression;
@ -71,6 +73,7 @@ use PhpParser\Node\Stmt\Finally_;
use PhpParser\Node\Stmt\For_;
use PhpParser\Node\Stmt\Foreach_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Return_;
@ -78,6 +81,7 @@ use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\Trait_;
use PhpParser\Node\Stmt\TryCatch;
use PhpParser\Node\Stmt\Unset_;
use PhpParser\Node\Stmt\While_;
use PhpParser\Node\UnionType;
use PhpParser\NodeTraverser;
use PHPStan\Analyser\MutatingScope;
@ -319,6 +323,10 @@ final class PHPStanNodeScopeResolver
$this->processEcho($node, $mutatingScope);
return;
}
if ($node instanceof If_ || $node instanceof ElseIf_ || $node instanceof Do_ || $node instanceof While_) {
$node->cond->setAttribute(AttributeKey::SCOPE, $mutatingScope);
return;
}
};
try {
$this->nodeScopeResolverProcessNodes($stmts, $scope, $nodeCallback);
@ -452,6 +460,7 @@ final class PHPStanNodeScopeResolver
}
private function processSwitch(Switch_ $switch, MutatingScope $mutatingScope) : void
{
$switch->cond->setAttribute(AttributeKey::SCOPE, $mutatingScope);
// decorate value as well
foreach ($switch->cases as $case) {
$case->setAttribute(AttributeKey::SCOPE, $mutatingScope);