Skip to content

Commit

Permalink
Dial back a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 17, 2024
1 parent e5ad342 commit f0b3d52
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Analyser/RuleErrorTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PHPStan\Rules\LineRuleError;
use PHPStan\Rules\MetadataRuleError;
use PHPStan\Rules\NonIgnorableRuleError;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\TipRuleError;

final class RuleErrorTransformer
Expand All @@ -17,7 +18,7 @@ final class RuleErrorTransformer
* @param class-string<Node> $nodeType
*/
public function transform(
IdentifierRuleError $ruleError,
RuleError $ruleError,
Scope $scope,
string $nodeType,
int $nodeLine,
Expand All @@ -29,6 +30,7 @@ public function transform(
$filePath = $scope->getFile();
$traitFilePath = null;
$tip = null;
$identifier = null;
$metadata = [];
if ($scope->isInTrait()) {
$traitReflection = $scope->getTraitReflection();
Expand Down Expand Up @@ -56,6 +58,10 @@ public function transform(
$tip = $ruleError->getTip();
}

if ($ruleError instanceof IdentifierRuleError) {
$identifier = $ruleError->getIdentifier();
}

if ($ruleError instanceof MetadataRuleError) {
$metadata = $ruleError->getMetadata();
}
Expand All @@ -74,7 +80,7 @@ public function transform(
$tip,
$nodeLine,
$nodeType,
$ruleError->getIdentifier(),
$identifier,
$metadata,
);
}
Expand Down

0 comments on commit f0b3d52

Please sign in to comment.