Skip to content

Commit ccb01ce

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 be1245f commit ccb01ce

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
@@ -534,6 +534,7 @@ protected function checkRoutes(string $uri): bool
534534
}
535535

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

0 commit comments

Comments
 (0)