From dfbbc5179f0dd893bb3d03399c192e6f9c73bfcc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 4 Oct 2023 08:45:47 +0000 Subject: [PATCH] Updated Rector to commit 4e56b7c4a9fa9747cb12025c94e07b85a30155bc https://github.com/rectorphp/rector-src/commit/4e56b7c4a9fa9747cb12025c94e07b85a30155bc [Php80] Remove AstResolver usage on PhpAttributeAnalyzer (#5111) --- .../Php80/NodeAnalyzer/PhpAttributeAnalyzer.php | 16 +++------------- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php index e9b816d4a80a..e7de49184061 100644 --- a/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php +++ b/rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php @@ -14,16 +14,10 @@ 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 @@ public function hasInheritedPhpAttribute(Class_ $class, string $attributeClass) $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; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index b03c0bb09d80..2d0ac032291c 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -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 */