Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Rules/Classes/ImpossibleInstanceOfRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public function processNode(Node $node, Scope $scope): array
$addTip(RuleErrorBuilder::message(sprintf(
'Instanceof between %s and %s will always evaluate to false.',
$expressionType->describe(VerbosityLevel::typeOnly()),
$classType->describe(VerbosityLevel::typeOnly()),
$classType->describe(VerbosityLevel::getRecommendedLevelByType($classType)),
)))->build(),
];
} elseif ($this->checkAlwaysTrueInstanceof) {
return [
$addTip(RuleErrorBuilder::message(sprintf(
'Instanceof between %s and %s will always evaluate to true.',
$expressionType->describe(VerbosityLevel::typeOnly()),
$classType->describe(VerbosityLevel::typeOnly()),
$classType->describe(VerbosityLevel::getRecommendedLevelByType($classType)),
)))->build(),
];
}
Expand Down
10 changes: 5 additions & 5 deletions tests/PHPStan/Rules/Classes/ImpossibleInstanceOfRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testInstanceof(): void
94,
],
[
'Instanceof between string and string will always evaluate to false.',
'Instanceof between string and \'str\' will always evaluate to false.',
98,
],
[
Expand Down Expand Up @@ -169,12 +169,12 @@ public function testInstanceof(): void
419,
],
[
'Instanceof between class-string<DateTimeInterface> and string will always evaluate to false.',
'Instanceof between class-string<DateTimeInterface> and \'DateTimeInterface\' will always evaluate to false.',
432,
$tipText,
],
[
'Instanceof between DateTimeInterface and string will always evaluate to true.',
'Instanceof between DateTimeInterface and \'DateTimeInterface\' will always evaluate to true.',
433,
$tipText,
],
Expand All @@ -200,7 +200,7 @@ public function testInstanceofWithoutAlwaysTrue(): void
94,
],
[
'Instanceof between string and string will always evaluate to false.',
'Instanceof between string and \'str\' will always evaluate to false.',
98,
],
[
Expand Down Expand Up @@ -266,7 +266,7 @@ public function testInstanceofWithoutAlwaysTrue(): void
419,
],
[
'Instanceof between class-string<DateTimeInterface> and string will always evaluate to false.',
'Instanceof between class-string<DateTimeInterface> and \'DateTimeInterface\' will always evaluate to false.',
432,
$tipText,
],
Expand Down