Skip to content
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

Merged
merged 13 commits into from
Sep 12, 2024
Merged

[5.2] foreach usage #41982

merged 13 commits into from
Sep 12, 2024

Conversation

Denitz
Copy link
Contributor

@Denitz Denitz commented Sep 28, 2023

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

@HLeithner HLeithner changed the title 5.0 foreach usage [5.1] foreach usage Sep 30, 2023
@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:48
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.1-dev.

…l.php

Co-authored-by: Quy <quy@nomonkeybiz.com>
@rdeutz
Copy link
Contributor

rdeutz commented Oct 16, 2023

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.

@HLeithner HLeithner changed the base branch from 5.1-dev to 5.2-dev April 24, 2024 09:07
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.2-dev.

@HLeithner HLeithner changed the title [5.1] foreach usage [5.2] foreach usage Apr 24, 2024
@HLeithner HLeithner changed the base branch from 5.2-dev to 5.3-dev September 2, 2024 08:52
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.3-dev.

@HLeithner HLeithner changed the title [5.2] foreach usage [5.3] foreach usage Sep 2, 2024
@Hackwar Hackwar changed the base branch from 5.3-dev to 5.2-dev September 3, 2024 11:03
@Hackwar Hackwar changed the title [5.3] foreach usage [5.2] foreach usage Sep 3, 2024
HLeithner
HLeithner previously approved these changes Sep 11, 2024
@Hackwar Hackwar dismissed HLeithner’s stale review September 11, 2024 17:48

Approved the wrong PR.

@Hackwar Hackwar enabled auto-merge (squash) September 12, 2024 09:55
@Hackwar Hackwar added this to the Joomla! 5.2.0 milestone Sep 12, 2024
@Hackwar
Copy link
Member

Hackwar commented Sep 12, 2024

Thank you for your contribution @Denitz!

@Hackwar Hackwar merged commit 63ba5aa into joomla:5.2-dev Sep 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants