Skip to content

Commit

Permalink
Updated Rector to commit 4e56b7c4a9fa9747cb12025c94e07b85a30155bc
Browse files Browse the repository at this point in the history
rectorphp/rector-src@4e56b7c [Php80] Remove AstResolver usage on PhpAttributeAnalyzer (#5111)
  • Loading branch information
TomasVotruba committed Oct 4, 2023
1 parent ea462b8 commit dfbbc51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions rules/Php80/NodeAnalyzer/PhpAttributeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit dfbbc51

Please sign in to comment.