diff --git a/composer.json b/composer.json index 9d25902..b43a4dc 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "sharkk/router", "description": "A simple node-based router.", - "version": "1.1.3", + "version": "1.1.4", "type": "library", "license": "MIT", "autoload": { diff --git a/src/SegmentRouter.php b/src/SegmentRouter.php index 49cb5b1..a712f80 100644 --- a/src/SegmentRouter.php +++ b/src/SegmentRouter.php @@ -40,7 +40,7 @@ class SegmentRouter implements Router if ($uri === '/') { return isset($node[$method]) ? ['code' => 200, 'handler' => $node[$method], 'params' => null] - : ['code' => 405]; + : ['code' => 405, 'handler' => null, 'params' => null]; } // We'll split up the URI into segments and traverse the node tree @@ -59,13 +59,13 @@ class SegmentRouter implements Router } // if we can't find a node for this segment, return 404 - return ['code' => 404]; + return ['code' => 404, 'handler' => null, 'params' => null]; } // if we found a handler for the method, return it and any params. if not, return a 405 return isset($node[$method]) ? ['code' => 200, 'handler' => $node[$method], 'params' => $params ?? null] - : ['code' => 405]; + : ['code' => 405, 'handler' => null, 'params' => null]; } public function clear(): Router