Skip to content

Commit

Permalink
Fix regression – detect unused params with defaults again
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Sep 14, 2020
1 parent ae4feae commit 7e53865
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/PhpVisitor/ReflectorVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@ public function getTranslatedFunctionParam(
$param_type,
new CodeLocation(
$this->file_scanner,
$fake_method ? $stmt : $param,
$fake_method ? $stmt : $param->var,
null,
false,
!$fake_method
Expand Down
5 changes: 5 additions & 0 deletions tests/UnusedVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,11 @@ function f(callable $c): void {
);',
'error_message' => 'UnusedClosureParam',
],
'unusedFunctionParamWithDefault' => [
'<?php
function foo(bool $b = false) : void {}',
'error_message' => 'UnusedParam',
],
];
}
}

0 comments on commit 7e53865

Please sign in to comment.