Skip to content

Commit d94c9d3

Browse files
committed
refactor: explain the back-reference replacement in checkRoutes()
The handler doubles as the preg_replace() replacement in the single-segment mode, which is not obvious from the call alone.
1 parent f60ab97 commit d94c9d3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎system/Router/Router.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ protected function checkRoutes(string $uri): bool
538538
}
539539

540540
if (config(Routing::class)->multipleSegmentsOneParam === false) {
541+
// $handler is the replacement, so its `$1` back-references are expanded here.
541542
$segments = explode('/', preg_replace('#\A' . $routeKey . '\z#u', $handler, $uri));
542543
} else {
543544
if (str_contains($methodAndParams, '/')) {

0 commit comments

Comments
 (0)