Skip to content

Commit 6adc439

Browse files
Fix
1 parent 42bf0a3 commit 6adc439

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Analyser/RuleErrorTransformer.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@ public function transform(
170170

171171
public static function getStartLineFromNode(Node $node): int
172172
{
173-
$line = match (true) {
174-
$node instanceof PropertyAssignNode => self::getStartLineFromNode($node->getPropertyFetch()),
175-
$node instanceof Node\Expr\PropertyFetch,
176-
$node instanceof Node\Expr\MethodCall => $node->name->getStartLine(),
177-
default => -1,
178-
};
173+
if (
174+
$node instanceof Node\Expr\PropertyFetch
175+
|| $node instanceof Node\Expr\MethodCall
176+
) {
177+
$line = $node->name->getStartLine();
178+
} elseif ($node instanceof PropertyAssignNode) {
179+
$line = self::getStartLineFromNode($node->getPropertyFetch());
180+
} else {
181+
return $node->getStartLine();
182+
}
179183

180184
return $line !== -1 ? $line : $node->getStartLine();
181185
}

0 commit comments

Comments
 (0)