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

[8.x] Remove useless loop #36722

Merged
merged 1 commit into from
Mar 24, 2021
Merged

[8.x] Remove useless loop #36722

merged 1 commit into from
Mar 24, 2021

Conversation

mgrinspan
Copy link
Contributor

I was going to point out that $search was incorrectly used instead of $s in the original code, but then I realized that the code still works as-is, albeit with redundant calls to str_(i)replace. Realizing this, we can just remove the loop altogether. There's also no need to call Arr::wrap for the same reason- str_(i)replace supports both arrays and strings as input.

@rcerljenko
Copy link

There's also no need for $subject variable. Just directly return the result of a ternary operation.

@taylorotwell taylorotwell merged commit c04fa17 into laravel:8.x Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants