From 11f05b657f072a6abd96d2dca22afb35e2ceef30 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 18 May 2023 18:55:12 +0000 Subject: [PATCH] Updated Rector to commit 24f8610224663ef71ca2e4007ef89997303f53b9 https://github.com/rectorphp/rector-src/commit/24f8610224663ef71ca2e4007ef89997303f53b9 [NodeTypeResolver] Remove next node on PHPStanNodeScopeResolver (#3888) --- .../PHPStan/Scope/PHPStanNodeScopeResolver.php | 18 +++++++++++++----- src/Application/VersionResolver.php | 4 ++-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++++----- vendor/composer/autoload_static.php | 8 ++++---- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index 0b9f43b0f6f..1d5018e99d0 100644 --- a/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -43,6 +43,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\TypeCombinator; use Rector\Caching\Detector\ChangedFilesDetector; use Rector\Caching\FileSystem\DependencyResolver; +use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\Core\Exception\ShouldNotHappenException; use Rector\Core\NodeAnalyzer\ClassAnalyzer; use Rector\Core\PhpParser\Node\BetterNodeFinder; @@ -290,11 +291,18 @@ final class PHPStanNodeScopeResolver $originalStmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true); $originalStmt->setAttribute(AttributeKey::SCOPE, $mutatingScope); $this->processNodes([$originalStmt], $filePath, $mutatingScope); - $nextNode = $originalStmt->getAttribute(AttributeKey::NEXT_NODE); - while ($nextNode instanceof Stmt) { - $nextNode->setAttribute(AttributeKey::IS_UNREACHABLE, \true); - $this->processNodes([$nextNode], $filePath, $mutatingScope); - $nextNode = $nextNode->getAttribute(AttributeKey::NEXT_NODE); + $parentNode = $unreachableStatementNode->getAttribute(AttributeKey::PARENT_NODE); + if (!$parentNode instanceof StmtsAwareInterface) { + return; + } + $stmtKey = $unreachableStatementNode->getAttribute(AttributeKey::STMT_KEY); + $totalKeys = $parentNode->stmts === null ? 0 : \count($parentNode->stmts); + for ($key = $stmtKey + 1; $key < $totalKeys; ++$key) { + if (!isset($parentNode->stmts[$key])) { + continue; + } + $parentNode->stmts[$key]->setAttribute(AttributeKey::IS_UNREACHABLE, \true); + $this->processNodes([$parentNode->stmts[$key]], $filePath, $mutatingScope); } } private function processProperty(Property $property, MutatingScope $mutatingScope) : void diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 37522ce151a..65f87eec5e2 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 = '1c2865afd4556f1dc27b94e5d18145680c8e7497'; + public const PACKAGE_VERSION = '24f8610224663ef71ca2e4007ef89997303f53b9'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-05-18 22:33:01'; + public const RELEASE_DATE = '2023-05-19 01:51:10'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 712f156e353..a8398acc29e 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit01208f4de7da9413a352a38b230ea588::getLoader(); +return ComposerAutoloaderInitc811d8c459688b50539fb06d40047f43::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index cb936d9fc67..6786fae8687 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit01208f4de7da9413a352a38b230ea588 +class ComposerAutoloaderInitc811d8c459688b50539fb06d40047f43 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit01208f4de7da9413a352a38b230ea588 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit01208f4de7da9413a352a38b230ea588', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc811d8c459688b50539fb06d40047f43', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit01208f4de7da9413a352a38b230ea588', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc811d8c459688b50539fb06d40047f43', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit01208f4de7da9413a352a38b230ea588::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc811d8c459688b50539fb06d40047f43::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit01208f4de7da9413a352a38b230ea588::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitc811d8c459688b50539fb06d40047f43::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 0ecb9c227e0..d431953146e 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit01208f4de7da9413a352a38b230ea588 +class ComposerStaticInitc811d8c459688b50539fb06d40047f43 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3114,9 +3114,9 @@ class ComposerStaticInit01208f4de7da9413a352a38b230ea588 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit01208f4de7da9413a352a38b230ea588::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit01208f4de7da9413a352a38b230ea588::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit01208f4de7da9413a352a38b230ea588::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc811d8c459688b50539fb06d40047f43::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc811d8c459688b50539fb06d40047f43::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc811d8c459688b50539fb06d40047f43::$classMap; }, null, ClassLoader::class); }