Skip to content

Commit 36ff373

Browse files
committed
UnusedPrivateConstantRule - identifier and metadata
1 parent 83591fc commit 36ff373

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Rules/DeadCode/UnusedPrivateConstantRule.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,16 @@ public function processNode(Node $node, Scope $scope): array
5858

5959
$errors = [];
6060
foreach ($constants as $constantName => $constantNode) {
61-
$errors[] = RuleErrorBuilder::message(sprintf('Constant %s::%s is unused.', $classReflection->getDisplayName(), $constantName))->line($constantNode->getLine())->build();
61+
$errors[] = RuleErrorBuilder::message(sprintf('Constant %s::%s is unused.', $classReflection->getDisplayName(), $constantName))
62+
->line($constantNode->getLine())
63+
->identifier('deadCode.unusedClassConstant')
64+
->metadata([
65+
'classOrder' => $node->getClass()->getAttribute('statementOrder'),
66+
'classDepth' => $node->getClass()->getAttribute('statementDepth'),
67+
'classStartLine' => $node->getClass()->getStartLine(),
68+
'constantName' => $constantName,
69+
])
70+
->build();
6271
}
6372

6473
return $errors;

0 commit comments

Comments
 (0)