Skip to content

Commit

Permalink
UnusedPrivateMethodRule - identifier and metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 17, 2020
1 parent d9bd78d commit f96d159
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Rules/DeadCode/UnusedPrivateMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,16 @@ public function processNode(Node $node, Scope $scope): array
if ($methodNode->isStatic()) {
$methodType = 'Static method';
}
$errors[] = RuleErrorBuilder::message(sprintf('%s %s::%s() is unused.', $methodType, $classReflection->getDisplayName(), $methodName))->line($methodNode->getLine())->build();
$errors[] = RuleErrorBuilder::message(sprintf('%s %s::%s() is unused.', $methodType, $classReflection->getDisplayName(), $methodName))
->line($methodNode->getLine())
->identifier('deadCode.unusedMethod')
->metadata([
'classOrder' => $node->getClass()->getAttribute('statementOrder'),
'classDepth' => $node->getClass()->getAttribute('statementDepth'),
'classStartLine' => $node->getClass()->getStartLine(),
'methodName' => $methodName,
])
->build();
}

return $errors;
Expand Down

0 comments on commit f96d159

Please sign in to comment.