-
-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive "Access to private property $field of parent class A." #3572
Comments
Yes, it's a bug, it works in PHP: https://3v4l.org/AnGtO |
That looks a lot more like a bug in PHP to be honest. |
I wouldn't be so sure, you're accessing private property from A in A. |
Yeah, but that private property doesn't belong in B – you're essentially creating a weird mutant instance. |
@sunkan After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-13: Access to private property $field of parent class A.
+-1: Internal error: PHPStan\Rules\Methods\WrongCaseOfInheritedMethodRule::findMethod(): Argument #2 ($classReflection) must be of type PHPStan\Reflection\ClassReflection, null given, called in /var/task/vendor/phpstan/phpstan-strict-rules/src/Rules/Methods/WrongCaseOfInheritedMethodRule.php on line 40
+Run PHPStan with --debug option and post the stack trace to:
+https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md Full report
|
@sunkan After the latest push in 1.9.x, PHPStan now reports different result with your code snippet: @@ @@
-13: Access to private property $field of parent class A.
+No errors |
@sunkan After the latest push in 1.9.x, PHPStan now reports different result with your code snippet: @@ @@
-13: Access to private property $field of parent class A.
+No errors |
@sunkan After the latest push in 1.9.x, PHPStan now reports different result with your code snippet: @@ @@
-13: Access to private property $field of parent class A.
+No errors |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
I mostly want to know if this is the intended behavior for this warning or if this is a bug.
The reason I think it's a bug is because there is now warning or notice from php it self
Code snippet that reproduces the problem
https://phpstan.org/r/0db2cb6e-df24-4cbe-85ec-a85edc7d5c71
Expected output
No error should be reported.
The text was updated successfully, but these errors were encountered: