From b151d4b4843e4f15a0ab754c7a41bd7d9498dfc2 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 30 Jan 2021 11:16:59 +0900 Subject: [PATCH 1/3] refactor: fix param name --- system/Common.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/Common.php b/system/Common.php index 56264267ac96..34f687a13a94 100644 --- a/system/Common.php +++ b/system/Common.php @@ -901,17 +901,17 @@ function old(string $key, $default = null, $escape = 'html') * * If more control is needed, you must use $response->redirect explicitly. * - * @param string $uri + * @param string $route * * @return RedirectResponse */ - function redirect(string $uri = null): RedirectResponse + function redirect(string $route = null): RedirectResponse { $response = Services::redirectResponse(null, true); - if (! empty($uri)) + if (! empty($route)) { - return $response->route($uri); + return $response->route($route); } return $response; From d9bb92d01de5bef8010e7e2a8151c5c8f5d84fbb Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 30 Jan 2021 11:19:47 +0900 Subject: [PATCH 2/3] refactor: add use statements to resolve classes in PHPDoc --- system/Common.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/Common.php b/system/Common.php index 34f687a13a94..548e1e7fd406 100644 --- a/system/Common.php +++ b/system/Common.php @@ -9,14 +9,18 @@ * file that was distributed with this source code. */ +use CodeIgniter\Cache\CacheInterface; use CodeIgniter\Config\Factories; use CodeIgniter\Database\BaseConnection; use CodeIgniter\Database\ConnectionInterface; +use CodeIgniter\Debug\Timer; use CodeIgniter\Files\Exceptions\FileNotFoundException; +use CodeIgniter\HTTP\Exceptions\HTTPException; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\URI; +use CodeIgniter\Session\Session; use CodeIgniter\Test\TestLogger; use Config\App; use Config\Database; From f94f5ca79344a9b6d0da40fd4125064ea89e0626 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 30 Jan 2021 19:57:08 +0900 Subject: [PATCH 3/3] docs: update the user guide --- user_guide_src/source/general/common_functions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 6618dbea2b69..7bfca8d20d6d 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -278,9 +278,9 @@ Miscellaneous Functions Context can be used to substitute values in the message string. For full details, see the :doc:`Logging Information ` page. -.. php:function:: redirect( string $uri ) +.. php:function:: redirect( string $route ) - :param string $uri: The URI to redirect the user to. + :param string $route: The reverse-routed or named route to redirect the user to. Returns a RedirectResponse instance allowing you to easily create redirects:: @@ -305,7 +305,7 @@ Miscellaneous Functions // Copies all headers from the global response instance return redirect()->back()->withHeaders(); - When passing a URI into the function, it is treated as a reverse-route request, not a relative/full URI, + When passing an argument into the function, it is treated as a named/reverse-routed route, not a relative/full URI, treating it the same as using redirect()->route():: // Go to a named/reverse-routed URI