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

chore: simplify loops that are using end/prev functions #8352

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

kubawerlos
Copy link
Contributor

No description provided.

@kubawerlos kubawerlos enabled auto-merge (squash) January 5, 2025 21:45
@coveralls
Copy link

Coverage Status

coverage: 95.034% (-0.01%) from 95.046%
when pulling ea47524 on 6b7562617765726c6f73:simplify_loops
into b20ceff on PHP-CS-Fixer:master.

@kubawerlos kubawerlos changed the title chore: simplify loops using end/prev functions chore: simplify loops that are using end/prev functions Jan 6, 2025

foreach ($tokensAnalyzer->getClassyElements() as $index => $element) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were going from end to start originally. no need to do array_reverse here as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't need it. We only need to iterate tokens from the end if we insert some new ones (as they "push" the indexes) and we don't insert any here.

@kubawerlos kubawerlos merged commit 87df022 into PHP-CS-Fixer:master Jan 7, 2025
26 of 27 checks passed
@kubawerlos kubawerlos deleted the simplify_loops branch January 7, 2025 09:35
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.

3 participants