-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
PHP 8.2 - Ide helper files seem not recognized #1402
Comments
This seems to just be an issue in general with using mixins in this way now. I initially thought this was a bug too and created an issue in phpstan/phpstan#8939 but after some discussion it makes sense. PHPStan is assuming that because the IdeHelper class has no ide-helper could theoretically get around this by adding a fake get/set or AllowDynamicProperties to its generated class but I feel like both of those are just workarounds for the fact that I don't think mixins were made to do something like this. |
Wouldn't it be technically more correct if the classes generated in the helper file would actually There the |
Well, it works, however I don't if, technically it's more correct |
Do you have any news on this? Thank you |
Versions:
Description:
After the update to PHP 8.2 all @Property annotations which include in
_ide_helper_models.php
are not recognized and anAccess to an undefined property
is thrown. More specifically, I have the following model and the respective_ide_helper_models.php
All works fine with PHP Version 8.1. Although, using PHP 8.2 I get the mentioned error message (
Access to an undefined property App\Models\Article::$title
).About the issue, I have tried 3 different approaches. Please find them below
Result : Works
Comment : I prefer to keep my first structure using the
@mixin IdeHelperArticle
.#[\AllowDynamicProperties]
before model classResult : Not work
Comment : I found out that PHP 8.2 needs to have
#[\AllowDynamicProperties]
above the class to work however this approach does not solve the issue#[\AllowDynamicProperties]
insideide_helper_models.php
Result : works
Comment : I don't know why and how to enforce this feature at generation time of
ide_helper_models.php
fileIs there any setting that I have to enable in order to make
ide_helper_models.php
be compatible with PHP 8.2 or is there any other solution in order to keep the functionality as it is in PHP 8.1?Does anyone know why my Model class doesn't work in the same way after the update to PHP 8.2?
The text was updated successfully, but these errors were encountered: