-
Notifications
You must be signed in to change notification settings - Fork 98
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
Invalid finding: Auto-Generated ID is never assigned int #610
Comments
I have the same issue. Entity generatet via maker, id is nullable and autogenerated, PHPStan 2.0.2 (lvl 6). Nop setter, no __clone - just pure Symfony entity and fresh PHPStan installation. |
To share some more infos: this does not generally happen. Only in one Symfony bundle of at least 6 of my bundles that use Doctrine entities. I invested a few hours to find a reason and/or fix, but nothing worked.
|
Hello, I had the same issue. To ignore it for all the entities I added :
To the ignoreErrors. |
I confirm the following workaround works (file
I reproduce on a recent project, with standard configuration, on basic entities with or without the clone method. Code example on a basic doctrine entity :
If you do not wish (or can't, for any reason) edit your
|
Expected:
PHPStand understands that such a definition is valid and that $id is set to
int
by Doctrine.Actual:
Only happens when I have that clone method in place, which says that id is not null 😁
Playground: https://phpstan.org/r/ed1ce389-72ab-4deb-a1bc-6d570db17f87
But in that case it makes sense, as there is no Doctrine annotation/bridge available.
The text was updated successfully, but these errors were encountered: