Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR streamlines Slim v5 routing by removing unused basePath handling from RouteMatch creation and aligning related middleware/tests with the simplified API, while also improving route-argument handling safety.
Changes:
- Remove
basePathfromRouteMatchfactory usage and simplifyRoutingMiddleware::createRouteMatch()accordingly. - Initialize
Route::$argumentsto an empty array to avoid undefined-property usage. - Update tests and comments to reflect
RouteMatchusage and the updated factory signatures.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/Routing/RouteMatchTest.php |
Updates RouteMatch::notFound() / methodNotAllowed() calls to the new signatures (no basePath). |
tests/Middleware/RoutingMiddlewareTest.php |
Removes legacy RoutingResults import and updates assertions/comments to reference RouteMatch. |
Slim/Routing/Route.php |
Initializes $arguments to [] to avoid undefined property usage. |
Slim/Middleware/RoutingMiddleware.php |
Stops passing basePath into createRouteMatch() and removes the unused parameter from the method. |
Slim/Middleware/BasePathMiddleware.php |
Removes unused/commented-out code related to base-path attributes. |
Slim/Interfaces/RouteInterface.php |
Updates getArguments() phpdoc to array<string, mixed>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v5
Changed
RouteInterface::getArguments()return type updated fromarray<string, string>toarray<string, mixed>for improved flexibility.RoutingMiddlewareno longer passes or depends onbasePathwhen creatingRouteMatch.RoutingMiddleware::createRouteMatch()signature by removing unusedbasePathparameter.BasePathMiddlewareby removing unused/commented code.Fixed
Routeto prevent potential undefined property usage.RouteMatchAPI (removedbasePathparameter from factory methods).RouteMatchinstead of legacy routing results.Removed
basePathhandling inRouteMatchcreation and related test usage.