Updated Rector to commit aebf30995293f3ba2cb6bb2d10e3084f7e925a11

aebf309952 [StaticTypeMapper] Remove parent lookup on NameScopeFactory (#4252)
This commit is contained in:
Tomas Votruba 2023-06-17 10:37:31 +00:00
parent e00ac02415
commit 89c1a25d91
5 changed files with 31 additions and 21 deletions

View File

@ -14,7 +14,9 @@ use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\Generic\TemplateTypeMap;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\PhpParser\ClassLikeAstResolver;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Naming\Naming\UseImportsResolver;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\StaticTypeMapper\StaticTypeMapper;
@ -32,24 +34,29 @@ final class NameScopeFactory
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
/**
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
*/
private $betterNodeFinder;
/**
* @var \Rector\Naming\Naming\UseImportsResolver
*/
private $useImportsResolver;
/**
* @var \Rector\Core\Reflection\ReflectionResolver
*/
private $reflectionResolver;
/**
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
*/
private $classLikeAstResolver;
// This is needed to avoid circular references
/**
* @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->staticTypeMapper = $staticTypeMapper;
$this->betterNodeFinder = $betterNodeFinder;
$this->useImportsResolver = $useImportsResolver;
$this->reflectionResolver = $reflectionResolver;
$this->classLikeAstResolver = $classLikeAstResolver;
}
public function createNameScopeFromNodeWithoutTemplateTypes(Node $node) : NameScope
{
@ -93,10 +100,13 @@ final class NameScopeFactory
private function templateTemplateTypeMap(Node $node) : TemplateTypeMap
{
$nodeTemplateTypes = $this->resolveTemplateTypesFromNode($node);
$classLike = $this->betterNodeFinder->findParentType($node, ClassLike::class);
$classTemplateTypes = [];
if ($classLike instanceof ClassLike) {
$classTemplateTypes = $this->resolveTemplateTypesFromNode($classLike);
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
if ($classReflection instanceof ClassReflection) {
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
if ($classLike instanceof ClassLike) {
$classTemplateTypes = $this->resolveTemplateTypesFromNode($classLike);
}
}
$templateTypes = \array_merge($nodeTemplateTypes, $classTemplateTypes);
return new TemplateTypeMap($templateTypes);

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '3122f5ec7f47d275de30bfbc44f61607dbc9cc64';
public const PACKAGE_VERSION = 'aebf30995293f3ba2cb6bb2d10e3084f7e925a11';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-17 16:33:24';
public const RELEASE_DATE = '2023-06-17 17:33:17';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624::getLoader();
return ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624
class ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624
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__));
spl_autoload_unregister(array('ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff', 'loadClassLoader'));
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->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624
class ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3094,9 +3094,9 @@ class ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$classMap;
}, null, ClassLoader::class);
}