Updated Rector to commit 4e56b7c4a9fa9747cb12025c94e07b85a30155bc

4e56b7c4a9 [Php80] Remove AstResolver usage on PhpAttributeAnalyzer (#5111)
This commit is contained in:
Tomas Votruba 2023-10-04 08:45:47 +00:00
parent ea462b89c5
commit dfbbc5179f
2 changed files with 5 additions and 15 deletions

View File

@ -14,16 +14,10 @@ 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\NodeNameResolver\NodeNameResolver;
use Rector\PhpAttribute\Enum\DocTagNodeState;
final class PhpAttributeAnalyzer
{
/**
* @readonly
* @var \Rector\Core\PhpParser\AstResolver
*/
private $astResolver;
/**
* @readonly
* @var \Rector\NodeNameResolver\NodeNameResolver
@ -34,9 +28,8 @@ final class PhpAttributeAnalyzer
* @var \PHPStan\Reflection\ReflectionProvider
*/
private $reflectionProvider;
public function __construct(AstResolver $astResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
{
$this->astResolver = $astResolver;
$this->nodeNameResolver = $nodeNameResolver;
$this->reflectionProvider = $reflectionProvider;
}
@ -64,11 +57,8 @@ final class PhpAttributeAnalyzer
$classReflection = $this->reflectionProvider->getClass($className);
$ancestorClassReflections = \array_merge($classReflection->getParents(), $classReflection->getInterfaces());
foreach ($ancestorClassReflections as $ancestorClassReflection) {
$resolvedClass = $this->astResolver->resolveClassFromClassReflection($ancestorClassReflection);
if (!$resolvedClass instanceof Class_) {
continue;
}
if ($this->hasPhpAttribute($resolvedClass, $attributeClass)) {
$nativeReflection = $ancestorClassReflection->getNativeReflection();
if ($nativeReflection->getAttributes($attributeClass) !== []) {
return \true;
}
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '39e4f0ae398befb8ad1aa63b66e50cc62e9a3883';
public const PACKAGE_VERSION = '4e56b7c4a9fa9747cb12025c94e07b85a30155bc';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-10-04 14:21:42';
public const RELEASE_DATE = '2023-10-04 15:42:44';
/**
* @var int
*/