mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 9f5d6b9c9ab814382bacc1c127e1807ecc7aaec0
9f5d6b9c9a
Remove runtime autoloading from NodeTypeResolver (#3627)
This commit is contained in:
parent
1cb1664849
commit
cee0e8f32f
@ -49,10 +49,6 @@ final class NodeTypeResolver
|
||||
* @var array<class-string<Node>, NodeTypeResolverInterface>
|
||||
*/
|
||||
private $nodeTypeResolvers = [];
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $traitExistsCache = [];
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\TypeDeclaration\PHPStan\ObjectTypeSpecifier
|
||||
@ -319,27 +315,30 @@ final class NodeTypeResolver
|
||||
}
|
||||
private function isObjectTypeOfObjectType(ObjectType $resolvedObjectType, ObjectType $requiredObjectType) : bool
|
||||
{
|
||||
if ($resolvedObjectType->getClassName() === $requiredObjectType->getClassName()) {
|
||||
$requiredClassName = $requiredObjectType->getClassName();
|
||||
$resolvedClassName = $resolvedObjectType->getClassName();
|
||||
if ($resolvedClassName === $requiredClassName) {
|
||||
return \true;
|
||||
}
|
||||
if ($resolvedObjectType->isInstanceOf($requiredObjectType->getClassName())->yes()) {
|
||||
if ($resolvedObjectType->isInstanceOf($requiredClassName)->yes()) {
|
||||
return \true;
|
||||
}
|
||||
if (!$this->reflectionProvider->hasClass($resolvedObjectType->getClassName())) {
|
||||
if (!$this->reflectionProvider->hasClass($requiredClassName)) {
|
||||
return \false;
|
||||
}
|
||||
$classReflection = $this->reflectionProvider->getClass($resolvedObjectType->getClassName());
|
||||
if (!isset($this->traitExistsCache[$classReflection->getName()])) {
|
||||
$this->traitExistsCache[$classReflection->getName()] = \trait_exists($requiredObjectType->getClassName());
|
||||
$requiredClassReflection = $this->reflectionProvider->getClass($requiredClassName);
|
||||
if (!$this->reflectionProvider->hasClass($resolvedClassName)) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->traitExistsCache[$classReflection->getName()]) {
|
||||
foreach ($classReflection->getAncestors() as $ancestorClassReflection) {
|
||||
if ($ancestorClassReflection->hasTraitUse($requiredObjectType->getClassName())) {
|
||||
$resolvedClassReflection = $this->reflectionProvider->getClass($resolvedClassName);
|
||||
if ($requiredClassReflection->isTrait()) {
|
||||
foreach ($resolvedClassReflection->getAncestors() as $ancestorClassReflection) {
|
||||
if ($ancestorClassReflection->hasTraitUse($requiredClassName)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $classReflection->isSubclassOf($requiredObjectType->getClassName());
|
||||
return $resolvedClassReflection->isSubclassOf($requiredClassName);
|
||||
}
|
||||
private function resolveObjectType(ObjectType $resolvedObjectType, ObjectType $requiredObjectType) : bool
|
||||
{
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'f08216fc30ced0d29868a18cd1c2504a1a10ecd0';
|
||||
public const PACKAGE_VERSION = '9f5d6b9c9ab814382bacc1c127e1807ecc7aaec0';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-04-20 07:22:04';
|
||||
public const RELEASE_DATE = '2023-04-20 17:38:51';
|
||||
/**
|
||||
* @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';
|
||||
|
||||
return ComposerAutoloaderInit8e452c908c559e2af302722842f28e3a::getLoader();
|
||||
return ComposerAutoloaderInit68fa967774b8b594a9705a6a4bf4f353::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
|
||||
|
||||
class ComposerAutoloaderInit8e452c908c559e2af302722842f28e3a
|
||||
class ComposerAutoloaderInit68fa967774b8b594a9705a6a4bf4f353
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit8e452c908c559e2af302722842f28e3a
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8e452c908c559e2af302722842f28e3a', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit68fa967774b8b594a9705a6a4bf4f353', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8e452c908c559e2af302722842f28e3a', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit68fa967774b8b594a9705a6a4bf4f353', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8e452c908c559e2af302722842f28e3a::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit8e452c908c559e2af302722842f28e3a::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$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;
|
||||
|
||||
class ComposerStaticInit8e452c908c559e2af302722842f28e3a
|
||||
class ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3144,9 +3144,9 @@ class ComposerStaticInit8e452c908c559e2af302722842f28e3a
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8e452c908c559e2af302722842f28e3a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8e452c908c559e2af302722842f28e3a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8e452c908c559e2af302722842f28e3a::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit68fa967774b8b594a9705a6a4bf4f353::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user