From 8cf26b4d0dbcd2048031a3f01c6f66999cf4c010 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 21 Mar 2023 21:55:36 +0100 Subject: [PATCH] Better solution for groups without a prefix --- Route.php | 2 +- example.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Route.php b/Route.php index 30213dc..0539875 100644 --- a/Route.php +++ b/Route.php @@ -73,7 +73,7 @@ abstract class Route ); } - static function group(string $prefix = '', ?callable $callback = null) + static function group(string $prefix, callable $callback) { if (!str_starts_with( $_SERVER['REQUEST_URI'], diff --git a/example.php b/example.php index aaa8d00..7069b26 100644 --- a/example.php +++ b/example.php @@ -51,7 +51,7 @@ App::group('/test', function() { fn() => print('Testing 123')); // you may also define a group without a prefix - App::group(callback: function() { + App::group('', function() { App::get('/test', fn() => print('Testing 456')); });