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
Class App\Entity\User has an uninitialized readonly property $id. Assign it in the constructor. #7337
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
Fixed: phpstan/phpstan-src#1357 |
@ondrejmirtes I updated the PHPStan and deleted the result cache, but I still get this errors |
/cc @herndlm can you please verify the fix in phpstan-doctrine? Write a new RuleTestCase for the right rule and get the rule instance via self::getContained()->getByType(). And if the test passes, verify that it failed before the fix in PHPStan. Thank you 😊 |
Fixed and released in phpstan-doctrine 1.3.7. Please test it, thanks. |
Thank you. Works without problems |
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
Class App\Entity\User has an uninitialized readonly property $id. Assign it in the constructor.
Code snippet that reproduces the problem
I use
Symfony 6.1.0
andPHP 8.1.6
.Myuser
entity has this code:I install
phpstan/phpstan
andphpstan/phpstan-doctrine
andphpstan/phpstan-symfony
packages.When analyze with
PHPStan ( php vendor/bin/phpstan analyse src )
, display this error:Line 17 is :
private readonly int $id;
Expected output
private readonly int $id;
is correct and should not display an error.The text was updated successfully, but these errors were encountered: