From 194c0359f14c47c3fa6b69d20b156a75ac6b9a3b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 21 Feb 2024 08:05:42 +0000 Subject: [PATCH] Updated Rector to commit a4445df500e51deb893319e180c3fbdf64e8dc25 https://github.com/rectorphp/rector-src/commit/a4445df500e51deb893319e180c3fbdf64e8dc25 Cleanup scope check on UnreachableStatementNodeVisitor (#5648) --- src/Application/VersionResolver.php | 4 ++-- src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 5f266f60e46..9435123ea21 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 = '3b44873d14db5c15a33147bc6aa395e95ec17def'; + public const PACKAGE_VERSION = 'a4445df500e51deb893319e180c3fbdf64e8dc25'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-02-21 14:45:26'; + public const RELEASE_DATE = '2024-02-21 15:03:30'; /** * @var int */ diff --git a/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php b/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php index 990a500a3d4..52d328a6a41 100644 --- a/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php +++ b/src/PHPStan/NodeVisitor/UnreachableStatementNodeVisitor.php @@ -47,7 +47,9 @@ final class UnreachableStatementNodeVisitor extends NodeVisitorAbstract $isPassedUnreachableStmt = \false; $mutatingScope = $this->resolveScope($node->getAttribute(AttributeKey::SCOPE)); foreach ($node->stmts as $stmt) { - if (!$stmt->getAttribute(AttributeKey::SCOPE) instanceof MutatingScope) { + $hasMutatingScope = $stmt->getAttribute(AttributeKey::SCOPE) instanceof MutatingScope; + if (!$hasMutatingScope) { + $stmt->setAttribute(AttributeKey::SCOPE, $mutatingScope); $this->phpStanNodeScopeResolver->processNodes([$stmt], $this->filePath, $mutatingScope); } if ($stmt->getAttribute(AttributeKey::IS_UNREACHABLE) === \true) { @@ -56,7 +58,6 @@ final class UnreachableStatementNodeVisitor extends NodeVisitorAbstract } if ($isPassedUnreachableStmt) { $stmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true); - $stmt->setAttribute(AttributeKey::SCOPE, $mutatingScope); } } return null;