mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit aebf30995293f3ba2cb6bb2d10e3084f7e925a11
aebf309952
[StaticTypeMapper] Remove parent lookup on NameScopeFactory (#4252)
This commit is contained in:
parent
e00ac02415
commit
89c1a25d91
@ -14,7 +14,9 @@ use PHPStan\Reflection\ClassReflection;
|
|||||||
use PHPStan\Type\Generic\TemplateTypeMap;
|
use PHPStan\Type\Generic\TemplateTypeMap;
|
||||||
use PHPStan\Type\Type;
|
use PHPStan\Type\Type;
|
||||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||||
|
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||||
|
use Rector\Core\Reflection\ReflectionResolver;
|
||||||
use Rector\Naming\Naming\UseImportsResolver;
|
use Rector\Naming\Naming\UseImportsResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||||
@ -32,24 +34,29 @@ final class NameScopeFactory
|
|||||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||||
*/
|
*/
|
||||||
private $phpDocInfoFactory;
|
private $phpDocInfoFactory;
|
||||||
/**
|
|
||||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
|
||||||
*/
|
|
||||||
private $betterNodeFinder;
|
|
||||||
/**
|
/**
|
||||||
* @var \Rector\Naming\Naming\UseImportsResolver
|
* @var \Rector\Naming\Naming\UseImportsResolver
|
||||||
*/
|
*/
|
||||||
private $useImportsResolver;
|
private $useImportsResolver;
|
||||||
|
/**
|
||||||
|
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||||
|
*/
|
||||||
|
private $reflectionResolver;
|
||||||
|
/**
|
||||||
|
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||||
|
*/
|
||||||
|
private $classLikeAstResolver;
|
||||||
// This is needed to avoid circular references
|
// This is needed to avoid circular references
|
||||||
/**
|
/**
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
public function autowire(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, BetterNodeFinder $betterNodeFinder, UseImportsResolver $useImportsResolver) : void
|
public function autowire(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, BetterNodeFinder $betterNodeFinder, UseImportsResolver $useImportsResolver, ReflectionResolver $reflectionResolver, ClassLikeAstResolver $classLikeAstResolver) : void
|
||||||
{
|
{
|
||||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||||
$this->staticTypeMapper = $staticTypeMapper;
|
$this->staticTypeMapper = $staticTypeMapper;
|
||||||
$this->betterNodeFinder = $betterNodeFinder;
|
|
||||||
$this->useImportsResolver = $useImportsResolver;
|
$this->useImportsResolver = $useImportsResolver;
|
||||||
|
$this->reflectionResolver = $reflectionResolver;
|
||||||
|
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||||
}
|
}
|
||||||
public function createNameScopeFromNodeWithoutTemplateTypes(Node $node) : NameScope
|
public function createNameScopeFromNodeWithoutTemplateTypes(Node $node) : NameScope
|
||||||
{
|
{
|
||||||
@ -93,10 +100,13 @@ final class NameScopeFactory
|
|||||||
private function templateTemplateTypeMap(Node $node) : TemplateTypeMap
|
private function templateTemplateTypeMap(Node $node) : TemplateTypeMap
|
||||||
{
|
{
|
||||||
$nodeTemplateTypes = $this->resolveTemplateTypesFromNode($node);
|
$nodeTemplateTypes = $this->resolveTemplateTypesFromNode($node);
|
||||||
$classLike = $this->betterNodeFinder->findParentType($node, ClassLike::class);
|
|
||||||
$classTemplateTypes = [];
|
$classTemplateTypes = [];
|
||||||
if ($classLike instanceof ClassLike) {
|
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
|
||||||
$classTemplateTypes = $this->resolveTemplateTypesFromNode($classLike);
|
if ($classReflection instanceof ClassReflection) {
|
||||||
|
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||||
|
if ($classLike instanceof ClassLike) {
|
||||||
|
$classTemplateTypes = $this->resolveTemplateTypesFromNode($classLike);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$templateTypes = \array_merge($nodeTemplateTypes, $classTemplateTypes);
|
$templateTypes = \array_merge($nodeTemplateTypes, $classTemplateTypes);
|
||||||
return new TemplateTypeMap($templateTypes);
|
return new TemplateTypeMap($templateTypes);
|
||||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '3122f5ec7f47d275de30bfbc44f61607dbc9cc64';
|
public const PACKAGE_VERSION = 'aebf30995293f3ba2cb6bb2d10e3084f7e925a11';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-06-17 16:33:24';
|
public const RELEASE_DATE = '2023-06-17 17:33:17';
|
||||||
/**
|
/**
|
||||||
* @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 ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624::getLoader();
|
return ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff::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 ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624
|
class ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff', '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('ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$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 ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624
|
class ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -3094,9 +3094,9 @@ class ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624
|
|||||||
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 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$classMap;
|
$loader->classMap = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user