From 9b5983a35fb10dc44abd1f14192f3bffb20cc1bc Mon Sep 17 00:00:00 2001 From: sheychen Date: Sun, 10 Sep 2017 20:14:22 +0200 Subject: [PATCH] Typing and 404 --- src/App.php | 4 ++-- src/Router.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.php b/src/App.php index b8269ad..64e49b9 100644 --- a/src/App.php +++ b/src/App.php @@ -59,11 +59,11 @@ class App{ $this->router = new Router(isset($data['router']) ? $data['router'] : Path::get('config').'/Routes.php'); } - public function run($uri = null, array $filters = array()){ + public function run(string $uri = null, array $filters = array()){ $route = $this->router->run(($uri ?: $_SERVER['REQUEST_URI']), $filters); if(!isset($route)) - $this->error(new HttpException(404, 'Not Found')); + $this->error(new HttpException(404)); try{ $route->call($this, $this->config['namespace'], $this->config['controller']); diff --git a/src/Router.php b/src/Router.php index bd34d4d..f20e081 100644 --- a/src/Router.php +++ b/src/Router.php @@ -31,7 +31,7 @@ class Router{ * @param callable|string $callable Function to run or 'Controller#function' * @return Route */ - public function add(string $path, $callable):Route{ + public function add(string $path, $callable): Route{ $route = new Route($path, $callable); $this->routes[] = $route; return $route; @@ -44,7 +44,7 @@ class Router{ * @param array $filters * @return Route|null */ - public function run(string $url, array $filters):?Route{ + public function run(string $url, array $filters){ foreach($this->routes as $route){ if($route->match($url, $filters)) return $route; @@ -58,7 +58,7 @@ class Router{ * @param string $name * @return Route|null */ - public function get(string $name):?Route{ + public function get(string $name){ foreach($this->routes as $route){ if($route->matchName($name)) return $route;