@@ -92,16 +92,11 @@ public function refactor(Node $node): ?Node
9292 }
9393
9494 // only private methods have a closed set of local callers; public/protected can be called from outside
95+ // with a wider type we cannot see here
9596 if (! $ classMethod ->isPrivate ()) {
9697 continue ;
9798 }
9899
99- // local calls are the complete caller set only for a private method, or for any method of a final class
100- // that cannot be extended; otherwise a child class may call it with a wider type we cannot see here
101- if (! $ classMethod ->isPrivate () && ! $ node ->isFinal ()) {
102- continue ;
103- }
104-
105100 $ classMethodPhpDocInfo = $ this ->phpDocInfoFactory ->createFromNodeOrEmpty ($ classMethod );
106101
107102 $ methodCalls = $ this ->localMethodCallFinder ->match ($ node , $ classMethod );
@@ -167,7 +162,7 @@ public function refactor(Node $node): ?Node
167162 private function hasNestedArray (Type $ type ): bool
168163 {
169164 if ($ type instanceof UnionType) {
170- return array_any ($ type ->getTypes (), fn (Type $ unionedType ): bool => $ this ->hasNestedArray ($ unionedType ));
165+ return array_any ($ type ->getTypes (), fn (Type $ unionedType ): bool => $ this ->hasNestedArray ($ unionedType ));
171166 }
172167
173168 if (! $ type instanceof ArrayType) {
@@ -176,7 +171,7 @@ private function hasNestedArray(Type $type): bool
176171
177172 $ itemType = $ type ->getItemType ();
178173 if ($ itemType instanceof UnionType) {
179- return array_any ($ itemType ->getTypes (), fn (Type $ unionedItemType ): bool => $ unionedItemType instanceof ArrayType);
174+ return array_any ($ itemType ->getTypes (), fn (Type $ unionedItemType ): bool => $ unionedItemType instanceof ArrayType);
180175 }
181176
182177 return $ itemType instanceof ArrayType;
0 commit comments