-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Change the "main" function in NonComposerComponentRegistration.php to closure to avoid naming conflicts. #21831
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
Change the "main" function in NonComposerComponentRegistration.php to closure to avoid naming conflicts. #21831
Conversation
Hi @Hailong. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @sidolov, thank you for the review. |
@magento-cicd2 unfortunately, only members of the maintainers team are allowed to unassign developers from the pull request |
@magento run all tests |
Hi @Hailong, thank you for your contribution! |
…ration.php to closure to avoid naming conflicts. #21831
Description (*)
There is a function definition "main" in app/etc/NonComposerComponentRegistration.php, which is used by autoload. This change is to use a closure instead, to avoid naming conflicts.
Here is one scenario that the naming conflict happens:
I installed Magento 2.3 with
composer
as the document recommends:While later I need some new patches from the 2.3-develop branch, so I decided to change the Magento source to GitHub repository, my changes to the composer.json file looks like this:
(There is also a change to the
magento/magento2ce
composer.json to add the "map arrays" accordingly)Now since both the main project and
magento/magento2ce
would need to load theapp/etc/NonComposerComponentRegistration.php
, there will be an error says "Cannot redeclare ..."Change the main function definition to closure would definitely resolve this issue.
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
magento/magento2ce
vendor package directory and no conflict during autoload process.Contribution checklist (*)