Skip to content

Commit 5cb615c

Browse files
committed
ignore overriden private properties
1 parent fd8fe42 commit 5cb615c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/Rules/Deprecations/OverrideDeprecatedPropertyRule.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function processNode(Node $node, Scope $scope): array
2929
return [];
3030
}
3131

32+
if ($node->isPrivate()) {
33+
return [];
34+
}
35+
3236
$class = $scope->getClassReflection();
3337

3438
$parents = $class->getParents();

tests/Rules/Deprecations/OverrideDeprecatedPropertyRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function testDeprecatedPropertyOverride(): void
2323
[
2424
[
2525
'Class OverrideDeprecatedProperty\Child overrides deprecated property foo of class OverrideDeprecatedProperty\Foo.',
26-
15,
26+
20,
2727
],
2828
]
2929
);

tests/Rules/Deprecations/data/override-deprecated-property.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ class Foo
88
* @deprecated
99
*/
1010
public $foo;
11+
12+
/**
13+
* @deprecated
14+
*/
15+
private $bar;
1116
}
1217

1318
class Child extends Foo
1419
{
1520
public $foo;
21+
22+
private $bar;
1623
}

0 commit comments

Comments
 (0)