Skip to content

Commit

Permalink
MatchingTypeInSwitchCaseConditionRule - report more precise lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 16, 2020
1 parent 65cc4d8 commit 82c19b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
]);
}
Expand Down

0 comments on commit 82c19b1

Please sign in to comment.