From ad6680355927f06f48457fe9543afd3c9ea31b5f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 19 Jun 2023 17:49:54 +0000 Subject: [PATCH] Updated Rector to commit ecdfd969a95b35b9157ade06b4c32fd35c6e1370 https://github.com/rectorphp/rector-src/commit/ecdfd969a95b35b9157ade06b4c32fd35c6e1370 [NodeCollector] Remove parent lookup on ArrayCallableMethodMatcher (#4291) --- .../ArrayCallableMethodMatcher.php | 19 +++++++++---------- src/Application/VersionResolver.php | 4 ++-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++++----- vendor/composer/autoload_static.php | 8 ++++---- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php b/packages/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php index b16c5bb4442..d42f989eebd 100644 --- a/packages/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php +++ b/packages/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php @@ -10,9 +10,8 @@ use PhpParser\Node\Expr\ArrayItem; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Scalar\String_; -use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\ClassLike; use PHPStan\Analyser\Scope; +use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\MixedType; @@ -21,8 +20,8 @@ use PHPStan\Type\ThisType; use PHPStan\Type\Type; use PHPStan\Type\TypeWithClassName; use Rector\Core\Enum\ObjectReference; -use Rector\Core\PhpParser\Node\BetterNodeFinder; use Rector\Core\PhpParser\Node\Value\ValueResolver; +use Rector\Core\Reflection\ReflectionResolver; use Rector\Core\ValueObject\MethodName; use Rector\NodeCollector\ValueObject\ArrayCallable; use Rector\NodeCollector\ValueObject\ArrayCallableDynamicMethod; @@ -53,16 +52,16 @@ final class ArrayCallableMethodMatcher private $reflectionProvider; /** * @readonly - * @var \Rector\Core\PhpParser\Node\BetterNodeFinder + * @var \Rector\Core\Reflection\ReflectionResolver */ - private $betterNodeFinder; - public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder) + private $reflectionResolver; + public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver) { $this->nodeNameResolver = $nodeNameResolver; $this->nodeTypeResolver = $nodeTypeResolver; $this->valueResolver = $valueResolver; $this->reflectionProvider = $reflectionProvider; - $this->betterNodeFinder = $betterNodeFinder; + $this->reflectionResolver = $reflectionResolver; } /** * Matches array like: "[$this, 'methodName']" → ['ClassName', 'methodName'] @@ -155,11 +154,11 @@ final class ArrayCallableMethodMatcher { $classConstantReference = $this->valueResolver->getValue($classConstFetch); if ($classConstantReference === ObjectReference::STATIC) { - $classLike = $this->betterNodeFinder->findParentType($classConstFetch, Class_::class); - if (!$classLike instanceof ClassLike) { + $classReflection = $this->reflectionResolver->resolveClassReflection($classConstFetch); + if (!$classReflection instanceof ClassReflection || !$classReflection->isClass()) { return new MixedType(); } - $classConstantReference = (string) $this->nodeNameResolver->getName($classLike); + $classConstantReference = $classReflection->getName(); } // non-class value if (!\is_string($classConstantReference)) { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index e3b653a9f7b..4500db5a0e6 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 = '9e8925edfd766a78d2cc20684863899d64df9586'; + public const PACKAGE_VERSION = 'ecdfd969a95b35b9157ade06b4c32fd35c6e1370'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-06-20 00:22:32'; + public const RELEASE_DATE = '2023-06-20 00:45:58'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 2f0505c6ca6..66bf814cc76 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 ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624::getLoader(); +return ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 2a953270eee..575a707c358 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624 +class ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3 { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$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 60e77c9f3a3..6824374ce0e 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624 +class ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3096,9 +3096,9 @@ class ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$classMap; }, null, ClassLoader::class); }