From e170b07ca5f8ee21911307ebb9a2ad6ba94fe881 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 26 Mar 2025 11:10:00 +0000 Subject: [PATCH] Allow optional groups again --- Route.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Route.php b/Route.php index 6e38263..ecf679f 100644 --- a/Route.php +++ b/Route.php @@ -103,8 +103,11 @@ abstract class Route ); } - static function group(string $prefix = '', callable $callback) + static function group(string $prefix = '', ?callable $callback = null) { + if ($callback === null) { + throw new InvalidArgumentException('Argument $callback must be of type callable.'); + } if (!str_starts_with( self::getRequestPath(), self::$prefix . $prefix