Skip to content

Commit

Permalink
UnusedPrivateConstantRule - identifier and metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 17, 2020
1 parent 83591fc commit 36ff373
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Rules/DeadCode/UnusedPrivateConstantRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ public function processNode(Node $node, Scope $scope): array

$errors = [];
foreach ($constants as $constantName => $constantNode) {
$errors[] = RuleErrorBuilder::message(sprintf('Constant %s::%s is unused.', $classReflection->getDisplayName(), $constantName))->line($constantNode->getLine())->build();
$errors[] = RuleErrorBuilder::message(sprintf('Constant %s::%s is unused.', $classReflection->getDisplayName(), $constantName))
->line($constantNode->getLine())
->identifier('deadCode.unusedClassConstant')
->metadata([
'classOrder' => $node->getClass()->getAttribute('statementOrder'),
'classDepth' => $node->getClass()->getAttribute('statementDepth'),
'classStartLine' => $node->getClass()->getStartLine(),
'constantName' => $constantName,
])
->build();
}

return $errors;
Expand Down

0 comments on commit 36ff373

Please sign in to comment.