@@ -89,6 +89,26 @@ public function containsAssertCall(ClassMethod $classMethod): bool
8989 return $ hasNestedAssertOrMockCall ;
9090 }
9191
92+ public function isAssertMethodCall (MethodCall |StaticCall $ call ): bool
93+ {
94+ if (! $ call ->name instanceof Identifier) {
95+ return false ;
96+ }
97+
98+ $ callName = $ this ->nodeNameResolver ->getName ($ call ->name );
99+ if (! is_string ($ callName )) {
100+ return false ;
101+ }
102+
103+ foreach (self ::ASSERT_METHOD_NAME_PREFIXES as $ assertMethodNamePrefix ) {
104+ if (str_starts_with ($ callName , $ assertMethodNamePrefix )) {
105+ return true ;
106+ }
107+ }
108+
109+ return false ;
110+ }
111+
92112 private function hasDirectAssertOrMockCall (ClassMethod $ classMethod ): bool
93113 {
94114 return (bool ) $ this ->betterNodeFinder ->findFirst ((array ) $ classMethod ->stmts , function (Node $ node ): bool {
@@ -108,11 +128,11 @@ private function hasDirectAssertOrMockCall(ClassMethod $classMethod): bool
108128 return true ;
109129 }
110130
111- return $ this ->isAssertMethodName ($ node );
131+ return $ this ->isAssertMethodCall ($ node );
112132 }
113133
114134 if ($ node instanceof StaticCall) {
115- return $ this ->isAssertMethodName ($ node );
135+ return $ this ->isAssertMethodCall ($ node );
116136 }
117137
118138 return false ;
@@ -171,24 +191,4 @@ private function resolveClassMethodFromCall(StaticCall | MethodCall $call): ?Cla
171191
172192 return $ this ->astResolver ->resolveClassMethod ($ objectType ->getClassName (), $ methodName );
173193 }
174-
175- private function isAssertMethodName (MethodCall |StaticCall $ call ): bool
176- {
177- if (! $ call ->name instanceof Identifier) {
178- return false ;
179- }
180-
181- $ callName = $ this ->nodeNameResolver ->getName ($ call ->name );
182- if (! is_string ($ callName )) {
183- return false ;
184- }
185-
186- foreach (self ::ASSERT_METHOD_NAME_PREFIXES as $ assertMethodNamePrefix ) {
187- if (str_starts_with ($ callName , $ assertMethodNamePrefix )) {
188- return true ;
189- }
190- }
191-
192- return false ;
193- }
194194}
0 commit comments