From 5a61fded6a93d0385f961507e977fd1ad84349e1 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 10 Jan 2024 09:45:32 +0000 Subject: [PATCH] Updated Rector to commit e231caaf0ad81f75b287fb7b2b47f720627a7ca4 https://github.com/rectorphp/rector-src/commit/e231caaf0ad81f75b287fb7b2b47f720627a7ca4 [Performance] Remove loop StmtsAwareInterface on PHPStanNodeScopeResolver (#5450) --- src/Application/VersionResolver.php | 4 ++-- .../PHPStan/Scope/PHPStanNodeScopeResolver.php | 6 ------ src/ProcessAnalyzer/RectifiedAnalyzer.php | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index c4f63179d3d..d031bb3f7ca 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 = '9193b276de2d9e51e063740a9fea61a559750f19'; + public const PACKAGE_VERSION = 'e231caaf0ad81f75b287fb7b2b47f720627a7ca4'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-01-10 12:52:57'; + public const RELEASE_DATE = '2024-01-10 16:43:21'; /** * @var int */ diff --git a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index 60e5eb24134..85255a90103 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -51,7 +51,6 @@ use PHPStan\Node\UnreachableStatementNode; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\ObjectType; use PHPStan\Type\TypeCombinator; -use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\Exception\ShouldNotHappenException; use Rector\NodeAnalyzer\ClassAnalyzer; use Rector\NodeNameResolver\NodeNameResolver; @@ -147,11 +146,6 @@ final class PHPStanNodeScopeResolver $this->nodeScopeResolver->processNodes($node->stmts, $mutatingScope, $nodeCallback); return; } - if ($node instanceof StmtsAwareInterface && $node->stmts !== null) { - foreach ($node->stmts as $stmt) { - $stmt->setAttribute(AttributeKey::SCOPE, $mutatingScope); - } - } if (($node instanceof Expression || $node instanceof Return_ || $node instanceof EnumCase || $node instanceof Cast) && $node->expr instanceof Expr) { $node->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope); } elseif ($node instanceof Assign || $node instanceof AssignOp) { diff --git a/src/ProcessAnalyzer/RectifiedAnalyzer.php b/src/ProcessAnalyzer/RectifiedAnalyzer.php index 433d79f46b5..c557b659690 100644 --- a/src/ProcessAnalyzer/RectifiedAnalyzer.php +++ b/src/ProcessAnalyzer/RectifiedAnalyzer.php @@ -67,7 +67,7 @@ final class RectifiedAnalyzer return \true; } if ($node instanceof Stmt) { - return \array_keys($node->getAttributes()) === [AttributeKey::STMT_KEY]; + return !\in_array(AttributeKey::SCOPE, \array_keys($node->getAttributes()), \true); } return $node->getAttributes() === []; }