Allow optional groups again

This commit is contained in:
William 2025-03-26 11:10:00 +00:00
parent d0a026f5d9
commit e170b07ca5

View File

@ -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( if (!str_starts_with(
self::getRequestPath(), self::getRequestPath(),
self::$prefix . $prefix self::$prefix . $prefix