@@ -56,7 +56,7 @@ public function processNode(Node $node, Scope $scope): array
56
56
if (strtolower ($ methodName ) === '__clone ' ) {
57
57
continue ;
58
58
}
59
- $ methods [$ methodName ] = $ method ;
59
+ $ methods [strtolower ( $ methodName) ] = $ method ;
60
60
}
61
61
62
62
$ arrayCalls = [];
@@ -105,7 +105,7 @@ public function processNode(Node $node, Scope $scope): array
105
105
if ($ inMethod ->getName () === $ methodName ) {
106
106
continue ;
107
107
}
108
- unset($ methods [$ methodName ]);
108
+ unset($ methods [strtolower ( $ methodName) ]);
109
109
}
110
110
}
111
111
@@ -144,26 +144,27 @@ public function processNode(Node $node, Scope $scope): array
144
144
if ($ inMethod ->getName () === $ typeAndMethod ->getMethod ()) {
145
145
continue ;
146
146
}
147
- unset($ methods [$ typeAndMethod ->getMethod ()]);
147
+ unset($ methods [strtolower ( $ typeAndMethod ->getMethod () )]);
148
148
}
149
149
}
150
150
}
151
151
}
152
152
153
153
$ errors = [];
154
- foreach ($ methods as $ methodName => $ method ) {
154
+ foreach ($ methods as $ method ) {
155
+ $ originalMethodName = $ method ->getNode ()->name ->toString ();
155
156
$ methodType = 'Method ' ;
156
157
if ($ method ->getNode ()->isStatic ()) {
157
158
$ methodType = 'Static method ' ;
158
159
}
159
- $ errors [] = RuleErrorBuilder::message (sprintf ('%s %s::%s() is unused. ' , $ methodType , $ classReflection ->getDisplayName (), $ methodName ))
160
+ $ errors [] = RuleErrorBuilder::message (sprintf ('%s %s::%s() is unused. ' , $ methodType , $ classReflection ->getDisplayName (), $ originalMethodName ))
160
161
->line ($ method ->getNode ()->getLine ())
161
162
->identifier ('deadCode.unusedMethod ' )
162
163
->metadata ([
163
164
'classOrder ' => $ node ->getClass ()->getAttribute ('statementOrder ' ),
164
165
'classDepth ' => $ node ->getClass ()->getAttribute ('statementDepth ' ),
165
166
'classStartLine ' => $ node ->getClass ()->getStartLine (),
166
- 'methodName ' => $ methodName ,
167
+ 'methodName ' => $ originalMethodName ,
167
168
])
168
169
->build ();
169
170
}
0 commit comments