From a493db6ec80532a743480f9d8baf815753692e0f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 11 Feb 2024 10:36:26 +0900 Subject: [PATCH] docs: add user guide --- user_guide_src/source/changelogs/v4.5.0.rst | 2 ++ user_guide_src/source/incoming/routing.rst | 11 +++++--- .../source/installation/upgrade_450.rst | 27 ++++++++++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index 591879b0ebfb..cba3126b624e 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -75,6 +75,8 @@ Others - **Autoloader:** The prefix ``\`` in the fully qualified classname returned by ``FileLocator::findQualifiedNameFromPath()`` has been removed. - **BaseModel:** The ``getIdValue()`` method has been changed to ``abstract``. +- **Routing:** The :ref:`404-override` feature does change the Response status + code to 404 by default. See :ref:`Upgrading Guide `. Interface Changes ================= diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index 71ee8ad3e296..cf781502a29f 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -686,6 +686,8 @@ to only those defined by you, by setting the ``$autoRoute`` property to false: .. warning:: If you use the :doc:`CSRF protection `, it does not protect **GET** requests. If the URI is accessible by the GET method, the CSRF protection will not work. +.. _404-override: + 404 Override ============ @@ -701,10 +703,11 @@ valid class/method pair, or a Closure: .. literalinclude:: routing/069.php -.. note:: The 404 Override feature does not change the Response status code to ``404``. - If you don't set the status code in the controller you set, the default status code ``200`` - will be returned. See :php:meth:`CodeIgniter\\HTTP\\Response::setStatusCode()` for - information on how to set the status code. +.. note:: Starting with v4.5.0, the 404 Override feature sets the Response status + code to ``404`` by default. In previous versions, the code was ``200``. + If you want to change the status code in the controller, see + :php:meth:`CodeIgniter\\HTTP\\Response::setStatusCode()` for information on + how to set the status code. Route Processing by Priority ============================ diff --git a/user_guide_src/source/installation/upgrade_450.rst b/user_guide_src/source/installation/upgrade_450.rst index 444e579280c9..0a770cb63bd6 100644 --- a/user_guide_src/source/installation/upgrade_450.rst +++ b/user_guide_src/source/installation/upgrade_450.rst @@ -213,10 +213,29 @@ using them, upgrade your code. See :ref:`ChangeLog set404Override(static function () { + response()->setStatusCode(200); + + echo view('my_errors/not_found.html'); + }); + +Validation::run() Signature +=========================== + +The method signatures of ``Validation::run()`` and ``ValidationInterface::run()`` +have been changed. The ``?string`` typehint on the ``$dbGroup`` parameter was +removed. Extending classes should likewise remove the parameter so as not to +break LSP. Project Files *************