Skip to content

Commit ea25caa

Browse files
committed
Fix UsageOfDeprecatedCastRule - it reported all casts, not just (string)
1 parent 9d8e7d4 commit ea25caa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Rules/Deprecations/UsageOfDeprecatedCastRule.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use function sprintf;
1111

1212
/**
13-
* @implements Rule<Cast>
13+
* @implements Rule<Cast\String_>
1414
*/
1515
class UsageOfDeprecatedCastRule implements Rule
1616
{
@@ -24,7 +24,7 @@ public function __construct(DeprecatedScopeHelper $deprecatedScopeHelper)
2424

2525
public function getNodeType(): string
2626
{
27-
return Cast::class;
27+
return Cast\String_::class;
2828
}
2929

3030
public function processNode(Node $node, Scope $scope): array

tests/Rules/Deprecations/data/usage-of-deprecated-cast.php

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ function deprecatedScope(Foo $foo): string
2424
{
2525
return (string) $foo;
2626
}
27+
28+
function foo2(Foo $foo): string {
29+
return (int) $foo;
30+
}

0 commit comments

Comments
 (0)