Closed TysonAndre closed 6 years ago
Also, @psalm-suppress UnusedVariable
isn't working for me on vimeo's master branch. (Both in function and global scope)
EDIT: It works if the suppression is on the doc comment of the function. However, it does not work when next to an assignment statement. For assignments in the global scope, there's no doc comment that could be used.
<?php
function test() : void {
/** @psalm-suppress UnusedVariable */
$var = 2;
}
I expected no errors, but saw this error with --find-dead-code
ERROR: UnusedVariable - src/suppress.php:5:5 - Variable $var is never referenced
/** @psalm-suppress UnusedVariable */
$var = 2;
I won't make a new issue, but that should be something that Psalm should pickup. Using the global
keyword should register as a use for that variable.
Sorry @tysonandre, @muglug can’t fix this tonight because he has to go to bed so he can get up early and go skiing with me tomorrow.
He feels bad about it, but I insist.
A quick solution would be to have a different issue type for unused global variables? (I haven't checked if this check is done across files)
UnusedVariable is emitted for the following example.