mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit ecdfd969a95b35b9157ade06b4c32fd35c6e1370
ecdfd969a9
[NodeCollector] Remove parent lookup on ArrayCallableMethodMatcher (#4291)
This commit is contained in:
parent
f9aed43e7b
commit
ad66803559
@ -10,9 +10,8 @@ use PhpParser\Node\Expr\ArrayItem;
|
|||||||
use PhpParser\Node\Expr\ClassConstFetch;
|
use PhpParser\Node\Expr\ClassConstFetch;
|
||||||
use PhpParser\Node\Expr\FuncCall;
|
use PhpParser\Node\Expr\FuncCall;
|
||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
use PhpParser\Node\Stmt\Class_;
|
|
||||||
use PhpParser\Node\Stmt\ClassLike;
|
|
||||||
use PHPStan\Analyser\Scope;
|
use PHPStan\Analyser\Scope;
|
||||||
|
use PHPStan\Reflection\ClassReflection;
|
||||||
use PHPStan\Reflection\ParametersAcceptorSelector;
|
use PHPStan\Reflection\ParametersAcceptorSelector;
|
||||||
use PHPStan\Reflection\ReflectionProvider;
|
use PHPStan\Reflection\ReflectionProvider;
|
||||||
use PHPStan\Type\MixedType;
|
use PHPStan\Type\MixedType;
|
||||||
@ -21,8 +20,8 @@ use PHPStan\Type\ThisType;
|
|||||||
use PHPStan\Type\Type;
|
use PHPStan\Type\Type;
|
||||||
use PHPStan\Type\TypeWithClassName;
|
use PHPStan\Type\TypeWithClassName;
|
||||||
use Rector\Core\Enum\ObjectReference;
|
use Rector\Core\Enum\ObjectReference;
|
||||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
|
||||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||||
|
use Rector\Core\Reflection\ReflectionResolver;
|
||||||
use Rector\Core\ValueObject\MethodName;
|
use Rector\Core\ValueObject\MethodName;
|
||||||
use Rector\NodeCollector\ValueObject\ArrayCallable;
|
use Rector\NodeCollector\ValueObject\ArrayCallable;
|
||||||
use Rector\NodeCollector\ValueObject\ArrayCallableDynamicMethod;
|
use Rector\NodeCollector\ValueObject\ArrayCallableDynamicMethod;
|
||||||
@ -53,16 +52,16 @@ final class ArrayCallableMethodMatcher
|
|||||||
private $reflectionProvider;
|
private $reflectionProvider;
|
||||||
/**
|
/**
|
||||||
* @readonly
|
* @readonly
|
||||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||||
*/
|
*/
|
||||||
private $betterNodeFinder;
|
private $reflectionResolver;
|
||||||
public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder)
|
public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, ValueResolver $valueResolver, ReflectionProvider $reflectionProvider, ReflectionResolver $reflectionResolver)
|
||||||
{
|
{
|
||||||
$this->nodeNameResolver = $nodeNameResolver;
|
$this->nodeNameResolver = $nodeNameResolver;
|
||||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||||
$this->valueResolver = $valueResolver;
|
$this->valueResolver = $valueResolver;
|
||||||
$this->reflectionProvider = $reflectionProvider;
|
$this->reflectionProvider = $reflectionProvider;
|
||||||
$this->betterNodeFinder = $betterNodeFinder;
|
$this->reflectionResolver = $reflectionResolver;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Matches array like: "[$this, 'methodName']" → ['ClassName', 'methodName']
|
* Matches array like: "[$this, 'methodName']" → ['ClassName', 'methodName']
|
||||||
@ -155,11 +154,11 @@ final class ArrayCallableMethodMatcher
|
|||||||
{
|
{
|
||||||
$classConstantReference = $this->valueResolver->getValue($classConstFetch);
|
$classConstantReference = $this->valueResolver->getValue($classConstFetch);
|
||||||
if ($classConstantReference === ObjectReference::STATIC) {
|
if ($classConstantReference === ObjectReference::STATIC) {
|
||||||
$classLike = $this->betterNodeFinder->findParentType($classConstFetch, Class_::class);
|
$classReflection = $this->reflectionResolver->resolveClassReflection($classConstFetch);
|
||||||
if (!$classLike instanceof ClassLike) {
|
if (!$classReflection instanceof ClassReflection || !$classReflection->isClass()) {
|
||||||
return new MixedType();
|
return new MixedType();
|
||||||
}
|
}
|
||||||
$classConstantReference = (string) $this->nodeNameResolver->getName($classLike);
|
$classConstantReference = $classReflection->getName();
|
||||||
}
|
}
|
||||||
// non-class value
|
// non-class value
|
||||||
if (!\is_string($classConstantReference)) {
|
if (!\is_string($classConstantReference)) {
|
||||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '9e8925edfd766a78d2cc20684863899d64df9586';
|
public const PACKAGE_VERSION = 'ecdfd969a95b35b9157ade06b4c32fd35c6e1370';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-06-20 00:22:32';
|
public const RELEASE_DATE = '2023-06-20 00:45:58';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624::getLoader();
|
return ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3::getLoader();
|
||||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624
|
class ComposerAutoloaderInitf7c95cef86065bd997dcd79c375b85d3
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit5f8f68659fbc828cd4efb53a7aa60624
|
|||||||
return self::$loader;
|
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__));
|
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';
|
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->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624
|
class ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -3096,9 +3096,9 @@ class ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit5f8f68659fbc828cd4efb53a7aa60624::$classMap;
|
$loader->classMap = ComposerStaticInitf7c95cef86065bd997dcd79c375b85d3::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user