Skip to content

Commit ae3a842

Browse files
committed
Don't report deprecations for deprecated anonymous classes in a deprecated scope
1 parent 2ac49f5 commit ae3a842

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

Diff for: src/Rules/Deprecations/ImplementationOfDeprecatedInterfaceRule.php

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function getNodeType(): string
3030
*/
3131
public function processNode(Node $node, Scope $scope): array
3232
{
33+
if (DeprecatedScopeHelper::isScopeDeprecated($scope)) {
34+
return [];
35+
}
36+
3337
$errors = [];
3438

3539
$className = isset($node->namespacedName)

Diff for: tests/Rules/Deprecations/ImplementationOfDeprecatedInterfaceRuleTest.php

-24
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,6 @@ public function testImplementationOfDeprecatedInterfacesInAnonymousClasses(): vo
5151
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable2.',
5252
13,
5353
],
54-
[
55-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable.',
56-
26,
57-
],
58-
[
59-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable.',
60-
30,
61-
],
62-
[
63-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable2.',
64-
30,
65-
],
66-
[
67-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable.',
68-
47,
69-
],
70-
[
71-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable.',
72-
51,
73-
],
74-
[
75-
'Anonymous class implements deprecated interface ImplementationOfDeprecatedInterface\DeprecatedFooable2.',
76-
51,
77-
],
7854
]
7955
);
8056
}

0 commit comments

Comments
 (0)