File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change 99use PHPStan \DependencyInjection \AutowiredService ;
1010use PHPStan \Reflection \ReflectionProvider ;
1111use PHPStan \ShouldNotHappenException ;
12- use function array_combine ;
13- use function array_map ;
1412use function array_merge ;
1513use function in_array ;
1614use function is_array ;
@@ -43,20 +41,18 @@ public function getUnusedParameters(
4341 string $ identifier ,
4442 ): array
4543 {
46- $ parameterNames = array_map (static function (Variable $ variable ): string {
44+ $ unusedParameters = [];
45+ foreach ($ parameterVars as $ variable ) {
4746 if (!is_string ($ variable ->name )) {
4847 throw new ShouldNotHappenException ();
4948 }
50- return $ variable ->name ;
51- }, $ parameterVars );
52- $ unusedParameters = array_combine ($ parameterNames , $ parameterVars );
53- foreach ($ this ->getUsedVariables ($ scope , $ statements ) as $ variableName ) {
54- if (!isset ($ unusedParameters [$ variableName ])) {
55- continue ;
56- }
5749
50+ $ unusedParameters [$ variable ->name ] = $ variable ;
51+ }
52+ foreach ($ this ->getUsedVariables ($ scope , $ statements ) as $ variableName ) {
5853 unset($ unusedParameters [$ variableName ]);
5954 }
55+
6056 $ errors = [];
6157 foreach ($ unusedParameters as $ name => $ variable ) {
6258 $ errorBuilder = RuleErrorBuilder::message (sprintf ($ unusedParameterMessage , $ name ))->identifier ($ identifier );
You can’t perform that action at this time.
0 commit comments