-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#3930Labels
Milestone
Description
Bug report
This specific false positive happens if a constructor creates a callback/closure, and that closure calls a method which accesses the readonly property.
These are the full requirements for the bug to be seen:
- A class has a readonly property.
- The property is set in the constructor.
- A method accesses that property.
- A callback/closure which calls the method is created in the constructor.
This bug started with version 1.10.23
and is still being reported with the latest version. The error isn't reported in earlier versions.
Code snippet that reproduces the problem
https://phpstan.org/r/9590d157-89fd-4d1f-8290-a7af4f82d461
Expected output
PHP shouldn't report an error.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan has been a huge help, it's great at finding bugs as part of our CICD system!
ermos and hackel