-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to suppress UnusedVariable for certain variable names? #540
Comments
Are you finding somewhere where it's not? |
I forgot about |
It would be great if the same could be applied for UnusedParam, as often parameter list is dictated by interface and parameters could not be omitted even if they are unused. I would suggest |
Agreed – just encountered this today |
Also, splitting issue types up for parameters based on the function/method/closure type ( (Private/Protected/Public)(/Final) and Closures) may be helpful. E.g. private methods should rarely ever need extra unused arguments (unless dynamically called), while public methods very often need unused parameters due to inheritance (as mentioned above). |
@TysonAndre that's handled with |
Psalm will now ignore any param beginning with |
sigh I actually hoped for prefix to be array_map(function(string $_a, string $_b, string $c): string { return $c; }, []); |
hey @muglug |
It would be useful to be able to suppress
$_
(EDIT: oh, that's supported already), and any variable name beginning with$unused
HHVM treats
$_
as an unused variable - It doesn't analyze that variable's type, for example.Sometimes an unused variable is unavoidable (e.g.
foreach ($arr as $key => $unusedMyClassInstance) { use($key); }
), or array destructuring assignments in php 7.0) (Edit: changed example)The text was updated successfully, but these errors were encountered: