-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
di:setup:compile fails with anonymous classes #26532
Comments
Hi @joni-jones. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @joni-jones do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @joni-jones. Thank you for working on this issue.
|
- Small refactoring for code simplification
Hi @joni-jones. Thank you for your report.
The fix will be available with the upcoming 2.4.0 release. |
- Fixed parsing for anonymous classes during di:compile run - Small code optimizations - Extended and refactored related unit tests
Preconditions (*)
The current implementation of
\Magento\Setup\Module\Di\Code\Scanner\PhpScanner
does not support classes that contain anonymous classes. This leads to failures fordi:setup:compile
command. The problem thatPhpScanner
treats anonymous classes as classes that might require code generation for factories and extension attributes.All Magento versions have this issue.
Steps to reproduce (*)
Magento\DummyModule\Dummy
(see a sample below)bin/magento setup:di:compile
CLI commandExpected result (*)
Actual result (*)
Class \Magento\DummyModule\$arg does not exist
Sample class:
To achieve the same error as described in #21555, the anonymous class should not provide a possibility to specify arguments for a constructor. In simple words,
return new class {
.The text was updated successfully, but these errors were encountered: