1010use PhpParser \Node \Expr \Array_ ;
1111use PhpParser \Node \Param ;
1212use PhpParser \Node \Scalar \String_ ;
13- use PhpParser \Node \Stmt \Class_ ;
1413use PhpParser \Node \Stmt \ClassLike ;
1514use PhpParser \Node \Stmt \ClassMethod ;
1615use PhpParser \Node \Stmt \Property ;
17- use PHPStan \Reflection \ReflectionProvider ;
1816use Rector \NodeNameResolver \NodeNameResolver ;
19- use Rector \Php81 \Enum \AttributeName ;
2017use Rector \PhpAttribute \Enum \DocTagNodeState ;
2118
2219final readonly class PhpAttributeAnalyzer
2320{
2421 public function __construct (
2522 private NodeNameResolver $ nodeNameResolver ,
26- private ReflectionProvider $ reflectionProvider ,
2723 ) {
2824 }
2925
@@ -42,29 +38,6 @@ public function hasPhpAttribute(Property | ClassLike | ClassMethod | Param $node
4238 return false ;
4339 }
4440
45- /**
46- * @param AttributeName::* $attributeClass
47- */
48- public function hasInheritedPhpAttribute (Class_ $ class , string $ attributeClass ): bool
49- {
50- $ className = (string ) $ this ->nodeNameResolver ->getName ($ class );
51- if (! $ this ->reflectionProvider ->hasClass ($ className )) {
52- return false ;
53- }
54-
55- $ classReflection = $ this ->reflectionProvider ->getClass ($ className );
56- $ ancestorClassReflections = [...$ classReflection ->getParents (), ...$ classReflection ->getInterfaces ()];
57-
58- foreach ($ ancestorClassReflections as $ ancestorClassReflection ) {
59- $ nativeReflection = $ ancestorClassReflection ->getNativeReflection ();
60- if ($ nativeReflection ->getAttributes ($ attributeClass ) !== []) {
61- return true ;
62- }
63- }
64-
65- return false ;
66- }
67-
6841 /**
6942 * @param string[] $attributeClasses
7043 */
0 commit comments