From 0c3dd7b35a7de493de1f15a4eabbfd5d2b2651ac Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Mon, 18 May 2026 21:55:49 +0200 Subject: [PATCH] Add missing identifiers Although identifiers are optional for phpstan, I use bladestan and when such an error is triggers, it _requires_ those errors having identifiers. And I think they're the way to go, anyway. --- lib/PhpUnitFqcnAnnotationRule.php | 2 +- lib/UnusedVariableRule.php | 2 +- phpstan-baseline.neon | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PhpUnitFqcnAnnotationRule.php b/lib/PhpUnitFqcnAnnotationRule.php index 2b5015e..9a73fae 100644 --- a/lib/PhpUnitFqcnAnnotationRule.php +++ b/lib/PhpUnitFqcnAnnotationRule.php @@ -61,7 +61,7 @@ public function processNode(Node $node, Scope $scope): array continue; } if (! $this->broker->hasClass($matches['className'])) { - $messages[] = RuleErrorBuilder::message(\sprintf('Class %s does not exist.', $matches['className']))->line($docComment->getStartLine() + $lineNumber)->build(); + $messages[] = RuleErrorBuilder::message(\sprintf('Class %s does not exist.', $matches['className']))->identifier('phpunit.annotationClassNotFound')->line($docComment->getStartLine() + $lineNumber)->build(); } } diff --git a/lib/UnusedVariableRule.php b/lib/UnusedVariableRule.php index 3639e6b..2adaf69 100644 --- a/lib/UnusedVariableRule.php +++ b/lib/UnusedVariableRule.php @@ -77,7 +77,7 @@ public function processNode(Node $node, Scope $scope): array ? \sprintf('Function %s()', $node->name) : 'Closure function', $varName - ))->line($var->getAttribute('startLine'))->build(); + ))->identifier('variable.unused')->line($var->getAttribute('startLine'))->build(); } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e52e732..a408694 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -43,7 +43,7 @@ parameters: path: lib/UnusedVariableRule.php - - message: '#^Parameter \#1 \$line of method PHPStan\\Rules\\RuleErrorBuilder\\:\:line\(\) expects int, mixed given\.$#' + message: '#^Parameter \#1 \$line of method PHPStan\\Rules\\RuleErrorBuilder\\:\:line\(\) expects int, mixed given\.$#' identifier: argument.type count: 1 path: lib/UnusedVariableRule.php