diff --git a/src/Rules/Functions/ClosureUsesThisRule.php b/src/Rules/Functions/ClosureUsesThisRule.php index d2cb4a4..4f41d26 100644 --- a/src/Rules/Functions/ClosureUsesThisRule.php +++ b/src/Rules/Functions/ClosureUsesThisRule.php @@ -42,7 +42,7 @@ public function processNode(Node $node, Scope $scope): array } $messages[] = RuleErrorBuilder::message(sprintf('Anonymous function uses $this assigned to variable $%s. Use $this directly in the function body.', $closureUse->var->name)) - ->line($closureUse->getLine()) + ->line($closureUse->getStartLine()) ->identifier('closure.useThis') ->build(); } diff --git a/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php b/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php index ded5d34..3dd0f8b 100644 --- a/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php +++ b/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php @@ -49,7 +49,7 @@ public function processNode(Node $node, Scope $scope): array $this->printer->prettyPrintExpr($case->cond), $caseType->describe(VerbosityLevel::typeOnly()), )) - ->line($case->getLine()) + ->line($case->getStartLine()) ->identifier('switch.type') ->build(); }