diff --git a/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index 1d5018e99d0..63f890f68aa 100644 --- a/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -12,7 +12,6 @@ use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\AssignOp; use PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\Cast; -use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Variable; @@ -46,7 +45,6 @@ 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; use Rector\Core\Util\Reflection\PrivatesAccessor; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -102,11 +100,6 @@ final class PHPStanNodeScopeResolver * @var \Rector\NodeNameResolver\NodeNameResolver */ private $nodeNameResolver; - /** - * @readonly - * @var \Rector\Core\PhpParser\Node\BetterNodeFinder - */ - private $betterNodeFinder; /** * @readonly * @var \Rector\Core\NodeAnalyzer\ClassAnalyzer @@ -115,7 +108,7 @@ final class PHPStanNodeScopeResolver /** * @param ScopeResolverNodeVisitorInterface[] $nodeVisitors */ - public function __construct(ChangedFilesDetector $changedFilesDetector, DependencyResolver $dependencyResolver, NodeScopeResolver $nodeScopeResolver, ReflectionProvider $reflectionProvider, array $nodeVisitors, \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory $scopeFactory, PrivatesAccessor $privatesAccessor, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, ClassAnalyzer $classAnalyzer) + public function __construct(ChangedFilesDetector $changedFilesDetector, DependencyResolver $dependencyResolver, NodeScopeResolver $nodeScopeResolver, ReflectionProvider $reflectionProvider, array $nodeVisitors, \Rector\NodeTypeResolver\PHPStan\Scope\ScopeFactory $scopeFactory, PrivatesAccessor $privatesAccessor, NodeNameResolver $nodeNameResolver, ClassAnalyzer $classAnalyzer) { $this->changedFilesDetector = $changedFilesDetector; $this->dependencyResolver = $dependencyResolver; @@ -124,7 +117,6 @@ final class PHPStanNodeScopeResolver $this->scopeFactory = $scopeFactory; $this->privatesAccessor = $privatesAccessor; $this->nodeNameResolver = $nodeNameResolver; - $this->betterNodeFinder = $betterNodeFinder; $this->classAnalyzer = $classAnalyzer; $this->nodeTraverser = new NodeTraverser(); foreach ($nodeVisitors as $nodeVisitor) { @@ -222,21 +214,17 @@ final class PHPStanNodeScopeResolver } private function setChildOfUnreachableStatementNodeAttribute(Stmt $stmt) : void { - if ($stmt->getAttribute(AttributeKey::IS_UNREACHABLE) === \true) { + if ($stmt->getAttribute(AttributeKey::IS_UNREACHABLE) !== \true) { return; } - $parentStmt = $stmt->getAttribute(AttributeKey::PARENT_NODE); - if (!$parentStmt instanceof Node) { + if (!$stmt instanceof StmtsAwareInterface) { return; } - if ($parentStmt instanceof Closure) { - $parentStmt = $this->betterNodeFinder->resolveCurrentStatement($parentStmt); - } - if (!$parentStmt instanceof Stmt) { + if ($stmt->stmts === null) { return; } - if ($parentStmt->getAttribute(AttributeKey::IS_UNREACHABLE) === \true) { - $stmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true); + foreach ($stmt->stmts as $childStmt) { + $childStmt->setAttribute(AttributeKey::IS_UNREACHABLE, \true); } } private function processArray(Array_ $array, MutatingScope $mutatingScope) : void diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index cf3144d538c..a30e5255bc0 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 = '62ecc9028796457cc58e717ac50c9d2cc5339b17'; + public const PACKAGE_VERSION = '3eadce164860c1d4465e40fd5e07fb11d3aa1b99'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-05-24 02:46:29'; + public const RELEASE_DATE = '2023-05-24 04:15:17'; /** * @var int */ diff --git a/src/Kernel/RectorKernel.php b/src/Kernel/RectorKernel.php index 8b72525b1e7..58113f179e9 100644 --- a/src/Kernel/RectorKernel.php +++ b/src/Kernel/RectorKernel.php @@ -15,7 +15,7 @@ final class RectorKernel /** * @var string */ - private const CACHE_KEY = 'v24'; + private const CACHE_KEY = 'v25'; /** * @var \Symfony\Component\DependencyInjection\ContainerInterface|null */ diff --git a/vendor/autoload.php b/vendor/autoload.php index f536f80b892..77be95bd0db 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 ComposerAutoloaderInit04d8ae861579222222f8bf9523047655::getLoader(); +return ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 5c633226675..61133331d15 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit04d8ae861579222222f8bf9523047655 +class ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit04d8ae861579222222f8bf9523047655 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit04d8ae861579222222f8bf9523047655', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit04d8ae861579222222f8bf9523047655', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitb7b74474b87e58ef937ad854d6d77003', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit04d8ae861579222222f8bf9523047655::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit04d8ae861579222222f8bf9523047655::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$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 c378d991e55..f9e31cde4f4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit04d8ae861579222222f8bf9523047655 +class ComposerStaticInitb7b74474b87e58ef937ad854d6d77003 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3106,9 +3106,9 @@ class ComposerStaticInit04d8ae861579222222f8bf9523047655 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit04d8ae861579222222f8bf9523047655::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit04d8ae861579222222f8bf9523047655::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit04d8ae861579222222f8bf9523047655::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitb7b74474b87e58ef937ad854d6d77003::$classMap; }, null, ClassLoader::class); }