From 7978144408e0a8d2ec5375831fb2111ef08e4b27 Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 10 Jun 2026 19:00:33 +0100 Subject: fixing tests and code formatting --- src/Group.php | 2 +- src/Router.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Group.php b/src/Group.php index aba0b82..05fa93b 100644 --- a/src/Group.php +++ b/src/Group.php @@ -58,7 +58,7 @@ class Group $prefixes = $this->getAncestorString(fn ($g) => $g->getPrefix()); $prefixes = array_map(fn (string $p) => trim($p, '/'), $prefixes); - return count($prefixes) > 0 ? '/'.implode('/', $prefixes): ''; + return count($prefixes) > 0 ? '/'.implode('/', $prefixes) : ''; } public function name(string $value): static diff --git a/src/Router.php b/src/Router.php index d6b255a..74c4e89 100644 --- a/src/Router.php +++ b/src/Router.php @@ -55,8 +55,11 @@ class Router /** @return string[] */ private function splitPath(string $path): array { - $split = explode('/', rtrim($path, '/')); - array_shift($split); + if (in_array($path, ['', '/'], true)) { + $split = []; + } else { + $split = explode('/', trim($path, '/')); + } return $split; } -- cgit v1.2.3