-
-
Notifications
You must be signed in to change notification settings - Fork 24
Remove restrictions from prependMiddleware() and middleware() methods #279
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
Conversation
klsoft-web
commented
Feb 6, 2026
| Q | A |
|---|---|
| Is bugfix? | ❌ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
| Fixed issues | #277 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #279 +/- ##
=============================================
- Coverage 97.40% 72.72% -24.68%
+ Complexity 181 178 -3
=============================================
Files 16 16
Lines 577 550 -27
=============================================
- Hits 562 400 -162
- Misses 15 150 +135 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes ordering restrictions around adding middleware in Route and Group, aligning behavior with issue #277 so middleware can be added both before and after actions/routes.
Changes:
- Allow
Route::middleware()to be called afteraction()by inserting middleware before the action handler. - Allow
Route::prependMiddleware()to be called beforeaction()(always prepends). - Remove
Groupordering restrictions so middleware can be added before/afterroutes()and vice versa, and update tests/changelog accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Route.php |
Adjusts middleware() behavior to insert before action when action is present; removes prependMiddleware() restriction. |
src/Group.php |
Removes state flags/exceptions that enforced ordering between routes() and middleware methods. |
tests/RouteTest.php |
Replaces exception-based tests with assertions covering new Route middleware ordering behavior. |
tests/GroupTest.php |
Updates tests to reflect relaxed ordering constraints in Group. |
CHANGELOG.md |
Documents enhancement #277. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thank you! |