diff --git a/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php b/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php index 98b3b60b..cdd61e82 100644 --- a/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php +++ b/src/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRule.php @@ -43,7 +43,7 @@ public function processNode(\PhpParser\Node $node, \PHPStan\Analyser\Scope $scop $conditionType->describe(VerbosityLevel::value()), $this->printer->prettyPrintExpr($case->cond), $caseType->describe(VerbosityLevel::typeOnly()) - ))->build(); + ))->line($case->getLine())->build(); } return $messages; diff --git a/tests/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRuleTest.php b/tests/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRuleTest.php index da421f0d..40b61d0e 100644 --- a/tests/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRuleTest.php +++ b/tests/Rules/SwitchConditions/MatchingTypeInSwitchCaseConditionRuleTest.php @@ -20,23 +20,23 @@ public function testRule(): void $this->analyse([__DIR__ . '/data/matching-type.php'], [ [ 'Switch condition type (1) does not match case condition \'test\' (string).', - 8, + 11, ], [ 'Switch condition type (1) does not match case condition 1 > 2 (false).', - 8, + 13, ], [ 'Switch condition type (\'1\') does not match case condition 1 (int).', - 19, + 20, ], [ 'Switch condition type (\'1\') does not match case condition \'test\' (string).', - 19, + 22, ], [ 'Switch condition type (\'1\') does not match case condition 1 > 2 (false).', - 19, + 24, ], ]); }