-
-
Notifications
You must be signed in to change notification settings - Fork 947
False positive: Access to private property $root of parent class Foo. #2435
Copy link
Copy link
Closed
phpstan/phpstan-src
#1953Labels
Milestone
Description
Bug report
Accessing private property of inherited class from parent class (where the property is defined) is valid, but PHPStan does not like it.
Code snippet that reproduces the problem
https://phpstan.org/r/2c1e2424-3b4d-4a31-aca7-0e8c74633a86
<?php
class Foo {
/** @var Bar|null */
private $root;
public function checkRoot(): bool {
return $this->root->root !== null;
}
}
class Bar extends Foo {
}+--------------------------------------------------------------+
| Line | test.php |
+--------------------------------------------------------------+
| 8 | Access to private property $root of parent class Foo. |
+--------------------------------------------------------------+
Expected output
The code is fine. PHPStan should be quiet.
Reactions are currently unavailable