@@ -102,6 +102,7 @@ public function refactor(Node $node): ?Node
102102 // methods invoked via a class-string static call, e.g. self::class::sampleClass(),
103103 // are not seen by the usage analyzer
104104 $ classStringCallMethodNames = $ this ->resolveClassStringStaticCallNames ($ node );
105+ $ scope = null ;
105106
106107 foreach ($ node ->stmts as $ classStmtKey => $ classStmt ) {
107108 if (! $ classStmt instanceof ClassMethod) {
@@ -113,24 +114,24 @@ public function refactor(Node $node): ?Node
113114 }
114115
115116 $ classMethod = $ classStmt ;
116- if ($ this ->hasDynamicMethodCallOnFetchThis ( $ classStmt )) {
117+ if ($ this ->isNames ( $ classMethod , $ dataProviderMethodNames )) {
117118 continue ;
118119 }
119120
120- $ scope = ScopeFetcher ::fetch ($ node );
121- if ($ this ->shouldSkip ($ classStmt , $ classReflection )) {
121+ if ($ this ->isNames ($ classMethod , $ classStringCallMethodNames )) {
122122 continue ;
123123 }
124124
125- if ($ this ->isClassMethodUsedAnalyzer -> isClassMethodUsed ( $ node , $ classStmt, $ scope )) {
125+ if ($ this ->hasDynamicMethodCallOnFetchThis ( $ classStmt )) {
126126 continue ;
127127 }
128128
129- if ($ this ->isNames ( $ classMethod , $ dataProviderMethodNames )) {
129+ if ($ this ->shouldSkip ( $ classStmt , $ classReflection )) {
130130 continue ;
131131 }
132132
133- if ($ this ->isNames ($ classMethod , $ classStringCallMethodNames )) {
133+ $ scope ??= ScopeFetcher ::fetch ($ node );
134+ if ($ this ->isClassMethodUsedAnalyzer ->isClassMethodUsed ($ node , $ classStmt , $ scope )) {
134135 continue ;
135136 }
136137
0 commit comments