Skip to content

Commit d01b919

Browse files
committed
ApiInstanceofTypeRule - tip with article
1 parent 3846372 commit d01b919

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Rules/Api/ApiInstanceofTypeRule.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ public function processNode(Node $node, Scope $scope): array
132132
'Doing instanceof %s is error-prone and deprecated. Use %s instead.',
133133
$className,
134134
$lowerMap[$lowerClassName],
135-
))->build(),
135+
))->tip(
136+
'Learn more: <fg=cyan>https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated</>',
137+
)->build(),
136138
];
137139
}
138140

tests/PHPStan/Rules/Api/ApiInstanceofTypeRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@ public function getRule(): Rule
1818

1919
public function testRule(): void
2020
{
21+
$tipText = 'Learn more: <fg=cyan>https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated</>';
2122
$this->analyse([__DIR__ . '/data/instanceof-type.php'], [
2223
[
2324
'Doing instanceof PHPStan\Type\TypeWithClassName is error-prone and deprecated. Use Type::getObjectClassNames() instead.',
2425
19,
26+
$tipText,
2527
],
2628
[
2729
'Doing instanceof phpstan\type\typewithclassname is error-prone and deprecated. Use Type::getObjectClassNames() instead.',
2830
23,
31+
$tipText,
2932
],
3033
[
3134
'Doing instanceof PHPStan\Type\TypeWithClassName is error-prone and deprecated. Use Type::getObjectClassNames() instead.',
3235
35,
36+
$tipText,
3337
],
3438
]);
3539
}

0 commit comments

Comments
 (0)