Skip to content

[12.x] Do not loop through middleware when excluded is empty #54837

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

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

cosmastech
Copy link
Contributor

@cosmastech cosmastech commented Feb 27, 2025

Just a minor optimization here. Each time the closure is called, it's checking if excluded is empty. We can just check that before starting the loop. Also, this avoids running filter functions on an empty excluded middleware array.

I recognize these are both relatively minor optimizations and probably wouldn't be noticeable for most applications.

Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@cosmastech cosmastech marked this pull request as ready for review February 27, 2025 23:35
@taylorotwell taylorotwell merged commit 7b8e12d into laravel:12.x Feb 28, 2025
39 checks passed
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.

2 participants