Skip to content

Commit

Permalink
Update FetchingDeprecatedConstRule.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes authored May 12, 2022
1 parent 914c542 commit 7bdf21f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Rules/Deprecations/FetchingDeprecatedConstRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,17 @@ public function processNode(Node $node, Scope $scope): array
}

$constantReflection = $this->reflectionProvider->getConstant($node->name, $scope);
$defaultMessage = 'Use of constant %s is deprecated.';

if ($constantReflection->isDeprecated()->yes()) {
return [sprintf(
$constantReflection->getDeprecatedDescription() ?? $defaultMessage,
$constantReflection->getDeprecatedDescription() ?? 'Use of constant %s is deprecated.',
$constantReflection->getName()
)];
}

if (isset($this->deprecatedConstants[$constantReflection->getName()])) {
return [sprintf(
$this->deprecatedConstants[$constantReflection->getName()] ?? $defaultMessage,
$this->deprecatedConstants[$constantReflection->getName()],
$constantReflection->getName()
)];
}
Expand Down

0 comments on commit 7bdf21f

Please sign in to comment.