From 637b17d7e470cbfde1472aa3faf87a88ef4fbab6 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Wed, 19 Apr 2023 20:58:11 +0800 Subject: [PATCH 1/2] docs: Add the functions return type `self`. --- system/Router/RouteCollectionInterface.php | 24 ++++++---------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/system/Router/RouteCollectionInterface.php b/system/Router/RouteCollectionInterface.php index a8f264a8b8fd..e95b7e98bd99 100644 --- a/system/Router/RouteCollectionInterface.php +++ b/system/Router/RouteCollectionInterface.php @@ -30,10 +30,8 @@ interface RouteCollectionInterface * * @param array|Closure|string $to * @param array $options - * - * @return mixed */ - public function add(string $from, $to, ?array $options = null); + public function add(string $from, $to, ?array $options = null): self; /** * Registers a new constraint with the system. Constraints are used @@ -45,34 +43,26 @@ public function add(string $from, $to, ?array $options = null); * * @param array|string $placeholder * @param string $pattern - * - * @return mixed */ - public function addPlaceholder($placeholder, ?string $pattern = null); + public function addPlaceholder($placeholder, ?string $pattern = null): self; /** * Sets the default namespace to use for Controllers when no other * namespace has been specified. - * - * @return mixed */ - public function setDefaultNamespace(string $value); + public function setDefaultNamespace(string $value): self; /** * Sets the default controller to use when no other controller has been * specified. - * - * @return mixed */ - public function setDefaultController(string $value); + public function setDefaultController(string $value): self; /** * Sets the default method to call on the controller when no other * method has been set in the route. - * - * @return mixed */ - public function setDefaultMethod(string $value); + public function setDefaultMethod(string $value): self; /** * Tells the system whether to convert dashes in URI strings into @@ -80,10 +70,8 @@ public function setDefaultMethod(string $value); * create more meaning and make it easier for the search engine to * find words and meaning in the URI for better SEO. But it * doesn't work well with PHP method names.... - * - * @return mixed */ - public function setTranslateURIDashes(bool $value); + public function setTranslateURIDashes(bool $value): self; /** * If TRUE, the system will attempt to match the URI against From eac26842aa05c60a4d5b97f5b991230619d6fc61 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Sat, 22 Apr 2023 18:09:13 +0800 Subject: [PATCH 2/2] docs: fix the type. --- system/Router/RouteCollectionInterface.php | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/system/Router/RouteCollectionInterface.php b/system/Router/RouteCollectionInterface.php index e95b7e98bd99..701e893dcd16 100644 --- a/system/Router/RouteCollectionInterface.php +++ b/system/Router/RouteCollectionInterface.php @@ -30,8 +30,10 @@ interface RouteCollectionInterface * * @param array|Closure|string $to * @param array $options + * + * @return RouteCollectionInterface */ - public function add(string $from, $to, ?array $options = null): self; + public function add(string $from, $to, ?array $options = null); /** * Registers a new constraint with the system. Constraints are used @@ -43,26 +45,34 @@ public function add(string $from, $to, ?array $options = null): self; * * @param array|string $placeholder * @param string $pattern + * + * @return RouteCollectionInterface */ - public function addPlaceholder($placeholder, ?string $pattern = null): self; + public function addPlaceholder($placeholder, ?string $pattern = null); /** * Sets the default namespace to use for Controllers when no other * namespace has been specified. + * + * @return RouteCollectionInterface */ - public function setDefaultNamespace(string $value): self; + public function setDefaultNamespace(string $value); /** * Sets the default controller to use when no other controller has been * specified. + * + * @return RouteCollectionInterface */ - public function setDefaultController(string $value): self; + public function setDefaultController(string $value); /** * Sets the default method to call on the controller when no other * method has been set in the route. + * + * @return RouteCollectionInterface */ - public function setDefaultMethod(string $value): self; + public function setDefaultMethod(string $value); /** * Tells the system whether to convert dashes in URI strings into @@ -70,8 +80,10 @@ public function setDefaultMethod(string $value): self; * create more meaning and make it easier for the search engine to * find words and meaning in the URI for better SEO. But it * doesn't work well with PHP method names.... + * + * @return RouteCollectionInterface */ - public function setTranslateURIDashes(bool $value): self; + public function setTranslateURIDashes(bool $value); /** * If TRUE, the system will attempt to match the URI against