From c1fbf9532fadebcfa6354681f567cf3c43b4e105 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 19 Dec 2024 12:34:02 +0800 Subject: [PATCH] refactor: add `@throws RedirectException` in Controller::initController --- system/Controller.php | 5 +++-- utils/phpstan-baseline/catch.neverThrown.neon | 8 -------- utils/phpstan-baseline/loader.neon | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 utils/phpstan-baseline/catch.neverThrown.neon diff --git a/system/Controller.php b/system/Controller.php index fc0c41bf18fa..9c6e7ee36a63 100644 --- a/system/Controller.php +++ b/system/Controller.php @@ -15,6 +15,7 @@ use CodeIgniter\HTTP\CLIRequest; use CodeIgniter\HTTP\Exceptions\HTTPException; +use CodeIgniter\HTTP\Exceptions\RedirectException; use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -77,7 +78,7 @@ class Controller * * @return void * - * @throws HTTPException + * @throws HTTPException|RedirectException */ public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -105,7 +106,7 @@ public function initController(RequestInterface $request, ResponseInterface $res * * @return void * - * @throws HTTPException + * @throws HTTPException|RedirectException */ protected function forceHTTPS(int $duration = 31_536_000) { diff --git a/utils/phpstan-baseline/catch.neverThrown.neon b/utils/phpstan-baseline/catch.neverThrown.neon deleted file mode 100644 index 1d590a78fac2..000000000000 --- a/utils/phpstan-baseline/catch.neverThrown.neon +++ /dev/null @@ -1,8 +0,0 @@ -# total 1 error - -parameters: - ignoreErrors: - - - message: '#^Dead catch \- CodeIgniter\\HTTP\\Exceptions\\RedirectException is never thrown in the try block\.$#' - count: 1 - path: ../../tests/system/ControllerTest.php diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index a0e8208d48a7..40d901a7ab2d 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -7,7 +7,6 @@ includes: - booleanNot.exprNotBoolean.neon - booleanOr.leftNotBoolean.neon - booleanOr.rightNotBoolean.neon - - catch.neverThrown.neon - class.notFound.neon - codeigniter.cacheHandlerInstance.neon - codeigniter.configArgumentInstanceof.neon