8
8
use PHPStan \Rules \LineRuleError ;
9
9
use PHPStan \Rules \MetadataRuleError ;
10
10
use PHPStan \Rules \NonIgnorableRuleError ;
11
+ use PHPStan \Rules \RuleError ;
11
12
use PHPStan \Rules \TipRuleError ;
12
13
13
14
final class RuleErrorTransformer
@@ -17,7 +18,7 @@ final class RuleErrorTransformer
17
18
* @param class-string<Node> $nodeType
18
19
*/
19
20
public function transform (
20
- IdentifierRuleError $ ruleError ,
21
+ RuleError $ ruleError ,
21
22
Scope $ scope ,
22
23
string $ nodeType ,
23
24
int $ nodeLine ,
@@ -29,6 +30,7 @@ public function transform(
29
30
$ filePath = $ scope ->getFile ();
30
31
$ traitFilePath = null ;
31
32
$ tip = null ;
33
+ $ identifier = null ;
32
34
$ metadata = [];
33
35
if ($ scope ->isInTrait ()) {
34
36
$ traitReflection = $ scope ->getTraitReflection ();
@@ -56,6 +58,10 @@ public function transform(
56
58
$ tip = $ ruleError ->getTip ();
57
59
}
58
60
61
+ if ($ ruleError instanceof IdentifierRuleError) {
62
+ $ identifier = $ ruleError ->getIdentifier ();
63
+ }
64
+
59
65
if ($ ruleError instanceof MetadataRuleError) {
60
66
$ metadata = $ ruleError ->getMetadata ();
61
67
}
@@ -74,7 +80,7 @@ public function transform(
74
80
$ tip ,
75
81
$ nodeLine ,
76
82
$ nodeType ,
77
- $ ruleError -> getIdentifier () ,
83
+ $ identifier ,
78
84
$ metadata ,
79
85
);
80
86
}
0 commit comments