Skip to content

Clean up routing middleware#3439

Merged
odan merged 3 commits intoslimphp:5.xfrom
odan:5.x-cleanup
Apr 4, 2026
Merged

Clean up routing middleware#3439
odan merged 3 commits intoslimphp:5.xfrom
odan:5.x-cleanup

Conversation

@odan
Copy link
Copy Markdown
Contributor

@odan odan commented Apr 3, 2026

v5

Changed

  • RouteInterface::getArguments() return type updated from array<string, string> to array<string, mixed> for improved flexibility.
  • RoutingMiddleware no longer passes or depends on basePath when creating RouteMatch.
  • Simplified RoutingMiddleware::createRouteMatch() signature by removing unused basePath parameter.
  • Minor cleanup in BasePathMiddleware by removing unused/commented code.

Fixed

  • Initialize route arguments with an empty array in Route to prevent potential undefined property usage.
  • Adjust tests to reflect updated RouteMatch API (removed basePath parameter from factory methods).
  • Updated test comments to reflect usage of RouteMatch instead of legacy routing results.

Removed

  • Unused basePath handling in RouteMatch creation and related test usage.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 3, 2026

Coverage Status

coverage: 96.768% (+0.6%) from 96.169%
when pulling d612560 on odan:5.x-cleanup
into 2f558e3 on slimphp:5.x.

Copy link
Copy Markdown

Copilot AI left a 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 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 basePath from RouteMatch factory usage and simplify RoutingMiddleware::createRouteMatch() accordingly.
  • Initialize Route::$arguments to an empty array to avoid undefined-property usage.
  • Update tests and comments to reflect RouteMatch usage 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.

@odan odan merged commit dbb6a71 into slimphp:5.x Apr 4, 2026
5 checks passed
@odan odan deleted the 5.x-cleanup branch April 4, 2026 11:24
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