From 91aaaa998d93c8b3d3709671326541d88e97087a Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 12 Jul 2020 21:58:46 +0800 Subject: [PATCH] Fix PHPDocs for Router --- .../Router/Exceptions/RedirectException.php | 45 ++++++++++++++- system/Router/Exceptions/RouterException.php | 55 ++++++++++++++++++- system/Router/RouteCollection.php | 54 +++++++++--------- 3 files changed, 126 insertions(+), 28 deletions(-) diff --git a/system/Router/Exceptions/RedirectException.php b/system/Router/Exceptions/RedirectException.php index 5c3f695570cd..611420766a47 100644 --- a/system/Router/Exceptions/RedirectException.php +++ b/system/Router/Exceptions/RedirectException.php @@ -1,12 +1,53 @@ routes['*'][$to]['route']; } - else if (array_key_exists($to, $this->routes['get'])) + elseif (array_key_exists($to, $this->routes['get'])) { $to = $this->routes['get'][$to]['route']; } @@ -724,8 +725,8 @@ public function getRedirectCode(string $from): int * $route->resource('users'); * }); * - * @param string $name The name to group/prefix the routes with. - * @param $params + * @param string $name The name to group/prefix the routes with. + * @param array ...$params * * @return void */ @@ -795,8 +796,8 @@ public function group(string $name, ...$params) * POST /photos/{id}/delete delete * POST /photos/{id} update * - * @param string $name The name of the resource/controller to route to. - * @param array $options An list of possible ways to customize the routing. + * @param string $name The name of the resource/controller to route to. + * @param array|null $options An list of possible ways to customize the routing. * * @return RouteCollectionInterface */ @@ -909,8 +910,8 @@ public function resource(string $name, array $options = null): RouteCollectionIn * GET /photos/remove/{id} remove show a form to confirm deletion of a specific photo object * POST /photos/delete/{id} delete deleting the specified photo object * - * @param string $name The name of the controller to route to. - * @param array $options An list of possible ways to customize the routing. + * @param string $name The name of the controller to route to. + * @param array|null $options An list of possible ways to customize the routing. * * @return RouteCollectionInterface */ @@ -1009,7 +1010,7 @@ public function presenter(string $name, array $options = null): RouteCollectionI * @param array $verbs * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1032,7 +1033,7 @@ public function match(array $verbs = [], string $from, $to, array $options = nul * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1050,7 +1051,7 @@ public function get(string $from, $to, array $options = null): RouteCollectionIn * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1068,7 +1069,7 @@ public function post(string $from, $to, array $options = null): RouteCollectionI * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1086,7 +1087,7 @@ public function put(string $from, $to, array $options = null): RouteCollectionIn * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1104,7 +1105,7 @@ public function delete(string $from, $to, array $options = null): RouteCollectio * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1122,7 +1123,7 @@ public function head(string $from, $to, array $options = null): RouteCollectionI * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1140,7 +1141,7 @@ public function patch(string $from, $to, array $options = null): RouteCollection * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1158,7 +1159,7 @@ public function options(string $from, $to, array $options = null): RouteCollecti * * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options * * @return \CodeIgniter\Router\RouteCollectionInterface */ @@ -1177,7 +1178,7 @@ public function cli(string $from, $to, array $options = null): RouteCollectionIn * @param string $env * @param \Closure $callback * - * @return RouteCollectionInterface + * @return \CodeIgniter\Router\RouteCollectionInterface */ public function environment(string $env, \Closure $callback): RouteCollectionInterface { @@ -1192,7 +1193,7 @@ public function environment(string $env, \Closure $callback): RouteCollectionInt //-------------------------------------------------------------------- /** - * Attempts to look up a route based on it's destination. + * Attempts to look up a route based on its destination. * * If a route exists: * @@ -1327,6 +1328,7 @@ public function getFilterForRoute(string $search): string * @param array|null $params * * @return string + * @throws \CodeIgniter\Router\Exceptions\RouterException */ protected function fillRouteParams(string $from, array $params = null): string { @@ -1369,7 +1371,7 @@ protected function fillRouteParams(string $from, array $params = null): string * @param string $verb * @param string $from * @param string|array $to - * @param array $options + * @param array|null $options */ protected function create(string $verb, string $from, $to, array $options = null) { @@ -1526,6 +1528,8 @@ private function checkSubdomains($subdomains): bool * * It's especially not perfect since it's possible to register a domain * with a period (.) as part of the domain name. + * + * @return mixed */ private function determineCurrentSubdomain() {