Skip to content
This repository has been archived by the owner on Sep 9, 2018. It is now read-only.

Commit

Permalink
Change issue types for closure/global function params
Browse files Browse the repository at this point in the history
  • Loading branch information
TysonAndre committed Mar 11, 2018
1 parent 373915d commit c20aea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/UnusedVariablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,14 @@ public function visitFuncDecl(Node $node)
*/
private function getIssueNameForMethodNode(Node $node, Context $context) : string
{
switch ($node->kind) {
case \ast\AST_FUNC_DECL:
return "PhanPluginUnusedGlobalFunctionArgument";
case \ast\AST_CLOSURE:
return "PhanPluginUnusedClosureArgument";
default:
break;
}
$fields = '';
$flags = $node->flags;
if (($flags & ast\flags\MODIFIER_PRIVATE) !== 0) {
Expand Down
6 changes: 3 additions & 3 deletions tests/expected/all_output.expected
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ src/000_all.php:475 PhanPluginUnusedVariable Variable is never used: $a
src/001_func.php:7 PhanPluginUnusedVariable Variable is never used: $one
src/001_func.php:8 PhanPluginUnusedVariable Variable is never used: $two
src/001_func.php:9 PhanNoopBinaryOperator Unused result of a binary '+' operator
src/001_func.php:25 PhanPluginUnusedPublicMethodArgument Parameter is never used: $three
src/001_func.php:25 PhanPluginUnusedGlobalFunctionArgument Parameter is never used: $three
src/002_closure.php:7 PhanPluginUnusedVariable Variable is never used: $one
src/002_closure.php:8 PhanPluginUnusedVariable Variable is never used: $two
src/002_closure.php:9 PhanNoopBinaryOperator Unused result of a binary '+' operator
src/002_closure.php:24 PhanPluginUnusedPublicMethodArgument Parameter is never used: $three
src/002_closure.php:24 PhanPluginUnusedClosureArgument Parameter is never used: $three
src/005_static_variables.php:24 PhanPluginUnusedVariable Variable is never used: $initialized
src/006_references.php:14 PhanPluginUnusedPublicMethodArgument Parameter is never used: $fifteen
src/006_references.php:35 PhanPluginUnnecessaryReference $sixteen is a reference to $seventeen, but $seventeen is never used
Expand All @@ -33,7 +33,7 @@ src/006_references.php:104 PhanPluginUnusedVariable Variable is never used: $sec
src/007_loops.php:18 PhanPluginUnusedVariable Variable is never used: $i
src/007_loops.php:26 PhanPluginUnusedVariable Variable is never used: $k
src/007_loops.php:26 PhanPluginUnusedVariable Variable is never used: $v
src/007_loops.php:32 PhanPluginUnusedPublicMethodArgument Parameter is never used: $start
src/007_loops.php:32 PhanPluginUnusedGlobalFunctionArgument Parameter is never used: $start
src/007_loops.php:33 PhanPluginUnusedVariable Variable is never used: $i
src/013_closure.php:10 PhanPluginUnusedClosureUseArgument Closure use variable is never used: $c
src/013_closure_simple.php:6 PhanPluginUnusedClosureUseArgument Closure use variable is never used: $c
Expand Down

0 comments on commit c20aea3

Please sign in to comment.