-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[5.2] foreach usage #41982
[5.2] foreach usage #41982
Conversation
This pull request has been automatically rebased to 5.1-dev. |
administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
Outdated
Show resolved
Hide resolved
…l.php Co-authored-by: Quy <quy@nomonkeybiz.com>
Co-authored-by: Quy <quy@nomonkeybiz.com>
administrator/components/com_modules/src/Controller/ModuleController.php
Outdated
Show resolved
Hide resolved
…roller.php Co-authored-by: Quy <quy@nomonkeybiz.com>
This needs to be done carefully because a foreach makes a copy of the array and works with the copy so a foreach consume more memory. So if you've a large array you can hit the memory_limit, if it is set to a low value. |
This pull request has been automatically rebased to 5.2-dev. |
This pull request has been automatically rebased to 5.3-dev. |
Thank you for your contribution @Denitz! |
Summary of Changes
Prefer foreach() over for(), especially for iterating objects. Foreach is simpler.
Testing Instructions
Apply patch.
Actual result BEFORE applying this Pull Request
Complex code.
Expected result AFTER applying this Pull Request
Simple code.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed