mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit e9a97469558e5e154a185bae388f214e1f0d5c56
e9a9746955
[PhpParser] Remove #[Required] on ClassLikeAstResolver (#4688)
This commit is contained in:
parent
d2266d0a76
commit
9fac241be1
@ -21,7 +21,7 @@ use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
@ -49,16 +49,16 @@ final class ArrayTypeAnalyzer
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, PhpDocInfoFactory $phpDocInfoFactory, ReflectionResolver $reflectionResolver, ClassLikeAstResolver $classLikeAstResolver)
|
||||
private $astResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, NodeTypeResolver $nodeTypeResolver, PhpDocInfoFactory $phpDocInfoFactory, ReflectionResolver $reflectionResolver, AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function isArrayType(Expr $expr) : bool
|
||||
{
|
||||
@ -118,7 +118,7 @@ final class ArrayTypeAnalyzer
|
||||
return \false;
|
||||
}
|
||||
/** @var ClassLike $classLike */
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($classReflection);
|
||||
$property = $classLike->getProperty($propertyName);
|
||||
if (!$property instanceof Property) {
|
||||
return \false;
|
||||
@ -147,7 +147,7 @@ final class ArrayTypeAnalyzer
|
||||
return \false;
|
||||
}
|
||||
/** @var ClassLike $classLike */
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($classReflection);
|
||||
$propertyName = $this->nodeNameResolver->getName($expr->name);
|
||||
if ($propertyName === null) {
|
||||
return \false;
|
||||
|
@ -14,7 +14,7 @@ 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\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Naming\Naming\UseImportsResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
@ -30,6 +30,11 @@ final class NameScopeFactory
|
||||
* @var \Rector\Naming\Naming\UseImportsResolver
|
||||
*/
|
||||
private $useImportsResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
@ -42,24 +47,20 @@ final class NameScopeFactory
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
public function __construct(UseImportsResolver $useImportsResolver)
|
||||
public function __construct(UseImportsResolver $useImportsResolver, AstResolver $astResolver)
|
||||
{
|
||||
$this->useImportsResolver = $useImportsResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
// This is needed to avoid circular references
|
||||
/**
|
||||
* @required
|
||||
*/
|
||||
public function autowire(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, ReflectionResolver $reflectionResolver, ClassLikeAstResolver $classLikeAstResolver) : void
|
||||
public function autowire(PhpDocInfoFactory $phpDocInfoFactory, StaticTypeMapper $staticTypeMapper, ReflectionResolver $reflectionResolver) : void
|
||||
{
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
}
|
||||
public function createNameScopeFromNodeWithoutTemplateTypes(Node $node) : NameScope
|
||||
{
|
||||
@ -106,7 +107,7 @@ final class NameScopeFactory
|
||||
$classTemplateTypes = [];
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
|
||||
if ($classReflection instanceof ClassReflection) {
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($classReflection);
|
||||
if ($classLike instanceof ClassLike) {
|
||||
$classTemplateTypes = $this->resolveTemplateTypesFromNode($classLike);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
@ -58,10 +59,10 @@ final class CountableAnalyzer
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, PropertyFetchAnalyzer $propertyFetchAnalyzer, ConstructorAssignDetector $constructorAssignDetector, ReflectionResolver $reflectionResolver, ClassLikeAstResolver $classLikeAstResolver)
|
||||
private $astResolver;
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, PropertyFetchAnalyzer $propertyFetchAnalyzer, ConstructorAssignDetector $constructorAssignDetector, ReflectionResolver $reflectionResolver, AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
@ -69,7 +70,7 @@ final class CountableAnalyzer
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->constructorAssignDetector = $constructorAssignDetector;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function isCastableArrayType(Expr $expr, ArrayType $arrayType, Scope $scope) : bool
|
||||
{
|
||||
@ -134,7 +135,7 @@ final class CountableAnalyzer
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
return \false;
|
||||
}
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($classReflection);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
return \false;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpAttribute\Enum\DocTagNodeState;
|
||||
@ -21,9 +22,9 @@ final class PhpAttributeAnalyzer
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
private $astResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
@ -34,9 +35,9 @@ final class PhpAttributeAnalyzer
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
public function __construct(ClassLikeAstResolver $classLikeAstResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
public function __construct(AstResolver $astResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
{
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
}
|
||||
@ -64,7 +65,7 @@ final class PhpAttributeAnalyzer
|
||||
$classReflection = $this->reflectionProvider->getClass($className);
|
||||
$ancestorClassReflections = \array_merge($classReflection->getParents(), $classReflection->getInterfaces());
|
||||
foreach ($ancestorClassReflections as $ancestorClassReflection) {
|
||||
$resolvedClass = $this->classLikeAstResolver->resolveClassFromClassReflection($ancestorClassReflection);
|
||||
$resolvedClass = $this->astResolver->resolveClassFromClassReflection($ancestorClassReflection);
|
||||
if (!$resolvedClass instanceof Class_) {
|
||||
continue;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ use PHPStan\Reflection\ClassReflection;
|
||||
use Rector\Core\Enum\ObjectReference;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\NodeManipulator\PropertyManipulator;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
@ -37,9 +38,9 @@ final class ParentPropertyLookupGuard
|
||||
private $propertyFetchAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
private $astResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeManipulator\PropertyManipulator
|
||||
@ -50,12 +51,12 @@ final class ParentPropertyLookupGuard
|
||||
* @var \Rector\Core\Util\Reflection\PrivatesAccessor
|
||||
*/
|
||||
private $privatesAccessor;
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, ClassLikeAstResolver $classLikeAstResolver, PropertyManipulator $propertyManipulator, PrivatesAccessor $privatesAccessor)
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer, AstResolver $astResolver, PropertyManipulator $propertyManipulator, PrivatesAccessor $privatesAccessor)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
$this->propertyManipulator = $propertyManipulator;
|
||||
$this->privatesAccessor = $privatesAccessor;
|
||||
}
|
||||
@ -87,7 +88,7 @@ final class ParentPropertyLookupGuard
|
||||
}
|
||||
private function isFoundInParentClassMethods(ClassReflection $parentClassReflection, string $propertyName, string $className) : bool
|
||||
{
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($parentClassReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($parentClassReflection);
|
||||
if (!$classLike instanceof Class_) {
|
||||
return \false;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer;
|
||||
@ -24,19 +25,19 @@ final class AllAssignNodePropertyTypeInferer
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
public function __construct(AssignToPropertyTypeInferer $assignToPropertyTypeInferer, NodeNameResolver $nodeNameResolver, ClassLikeAstResolver $classLikeAstResolver)
|
||||
private $astResolver;
|
||||
public function __construct(AssignToPropertyTypeInferer $assignToPropertyTypeInferer, NodeNameResolver $nodeNameResolver, AstResolver $astResolver)
|
||||
{
|
||||
$this->assignToPropertyTypeInferer = $assignToPropertyTypeInferer;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function inferProperty(Property $property, ClassReflection $classReflection) : ?Type
|
||||
{
|
||||
/** @var ClassLike $classLike */
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$classLike = $this->astResolver->resolveClassFromClassReflection($classReflection);
|
||||
$propertyName = $this->nodeNameResolver->getName($property);
|
||||
return $this->assignToPropertyTypeInferer->inferPropertyInClassLike($property, $propertyName, $classLike);
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0d62894545caec468b9ff170cfcf0566ccab6d3d';
|
||||
public const PACKAGE_VERSION = 'e9a97469558e5e154a185bae388f214e1f0d5c56';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-07 10:09:16';
|
||||
public const RELEASE_DATE = '2023-08-07 10:23:22';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -29,7 +29,6 @@ use Rector\Caching\CacheFactory;
|
||||
use Rector\CodingStyle\ClassNameImport\ShortNameResolver;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\Core\Util\Reflection\PrivatesAccessor;
|
||||
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
|
||||
@ -236,7 +235,7 @@ final class LazyContainerFactory
|
||||
$shortNameResolver->autowire($phpDocInfoFactory);
|
||||
});
|
||||
$container->afterResolving(NameScopeFactory::class, static function (NameScopeFactory $nameScopeFactory, Container $container) : void {
|
||||
$nameScopeFactory->autowire($container->make(PhpDocInfoFactory::class), $container->make(StaticTypeMapper::class), $container->make(ReflectionResolver::class), $container->make(ClassLikeAstResolver::class));
|
||||
$nameScopeFactory->autowire($container->make(PhpDocInfoFactory::class), $container->make(StaticTypeMapper::class), $container->make(ReflectionResolver::class));
|
||||
});
|
||||
$container->afterResolving(ArrayTypeMapper::class, static function (ArrayTypeMapper $arrayTypeMapper, Container $container) : void {
|
||||
$arrayTypeMapper->autowire($container->make(PHPStanStaticTypeMapper::class), $container->make(UnionTypeCommonTypeNarrower::class), $container->make(ReflectionProvider::class), $container->make(GenericClassStringTypeNormalizer::class), $container->make(DetailedTypeAnalyzer::class));
|
||||
|
@ -18,6 +18,7 @@ use PHPStan\Type\ObjectType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\NodeFinder\PropertyFetchFinder;
|
||||
@ -81,9 +82,9 @@ final class PropertyManipulator
|
||||
private $constructorAssignDetector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
private $astResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer
|
||||
@ -93,7 +94,7 @@ final class PropertyManipulator
|
||||
* @var string[]|class-string<Table>[]
|
||||
*/
|
||||
private const DOCTRINE_PROPERTY_ANNOTATIONS = ['Doctrine\\ORM\\Mapping\\Entity', 'Doctrine\\ORM\\Mapping\\Table', 'Doctrine\\ORM\\Mapping\\MappedSuperclass'];
|
||||
public function __construct(\Rector\Core\NodeManipulator\AssignManipulator $assignManipulator, BetterNodeFinder $betterNodeFinder, PhpDocInfoFactory $phpDocInfoFactory, PropertyFetchFinder $propertyFetchFinder, NodeNameResolver $nodeNameResolver, PhpAttributeAnalyzer $phpAttributeAnalyzer, NodeTypeResolver $nodeTypeResolver, PromotedPropertyResolver $promotedPropertyResolver, ConstructorAssignDetector $constructorAssignDetector, ClassLikeAstResolver $classLikeAstResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer)
|
||||
public function __construct(\Rector\Core\NodeManipulator\AssignManipulator $assignManipulator, BetterNodeFinder $betterNodeFinder, PhpDocInfoFactory $phpDocInfoFactory, PropertyFetchFinder $propertyFetchFinder, NodeNameResolver $nodeNameResolver, PhpAttributeAnalyzer $phpAttributeAnalyzer, NodeTypeResolver $nodeTypeResolver, PromotedPropertyResolver $promotedPropertyResolver, ConstructorAssignDetector $constructorAssignDetector, AstResolver $astResolver, PropertyFetchAnalyzer $propertyFetchAnalyzer)
|
||||
{
|
||||
$this->assignManipulator = $assignManipulator;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
@ -104,7 +105,7 @@ final class PropertyManipulator
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->promotedPropertyResolver = $promotedPropertyResolver;
|
||||
$this->constructorAssignDetector = $constructorAssignDetector;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
}
|
||||
/**
|
||||
@ -161,7 +162,7 @@ final class PropertyManipulator
|
||||
public function isUsedByTrait(ClassReflection $classReflection, string $propertyName) : bool
|
||||
{
|
||||
foreach ($classReflection->getTraits() as $traitUse) {
|
||||
$trait = $this->classLikeAstResolver->resolveClassFromClassReflection($traitUse);
|
||||
$trait = $this->astResolver->resolveClassFromClassReflection($traitUse);
|
||||
if (!$trait instanceof Trait_) {
|
||||
continue;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ final class AstResolver
|
||||
*/
|
||||
public function resolveClassFromClassReflection(ClassReflection $classReflection)
|
||||
{
|
||||
return $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
return $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection, $this);
|
||||
}
|
||||
/**
|
||||
* @return Trait_[]
|
||||
|
@ -12,7 +12,9 @@ use PhpParser\Node\Stmt\Trait_;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
|
||||
/**
|
||||
* @internal called from AstResolver
|
||||
*/
|
||||
final class ClassLikeAstResolver
|
||||
{
|
||||
/**
|
||||
@ -25,26 +27,15 @@ final class ClassLikeAstResolver
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @required
|
||||
*/
|
||||
public function autowire(\Rector\Core\PhpParser\AstResolver $astResolver) : void
|
||||
{
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Trait_|\PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Interface_|\PhpParser\Node\Stmt\Enum_|null
|
||||
*/
|
||||
public function resolveClassFromClassReflection(ClassReflection $classReflection)
|
||||
public function resolveClassFromClassReflection(ClassReflection $classReflection, \Rector\Core\PhpParser\AstResolver $astResolver)
|
||||
{
|
||||
if ($classReflection->isBuiltin()) {
|
||||
return null;
|
||||
@ -54,7 +45,7 @@ final class ClassLikeAstResolver
|
||||
if ($fileName === null) {
|
||||
return null;
|
||||
}
|
||||
$stmts = $this->astResolver->parseFileNameToDecoratedNodes($fileName);
|
||||
$stmts = $astResolver->parseFileNameToDecoratedNodes($fileName);
|
||||
if ($stmts === []) {
|
||||
return null;
|
||||
}
|
||||
|
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 ComposerAutoloaderInit339d5a9e2bfea805998bfe04c2e8d03d::getLoader();
|
||||
return ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992::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 ComposerAutoloaderInit339d5a9e2bfea805998bfe04c2e8d03d
|
||||
class ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit339d5a9e2bfea805998bfe04c2e8d03d
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit339d5a9e2bfea805998bfe04c2e8d03d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit339d5a9e2bfea805998bfe04c2e8d03d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$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 ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d
|
||||
class ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3010,9 +3010,9 @@ class ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit339d5a9e2bfea805998bfe04c2e8d03d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user