From 13717cb473bc02010c397ae30e3ea24e35c47d53 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 Mar 2023 11:01:40 +0900 Subject: [PATCH 001/237] docs: add links to other pages --- user_guide_src/source/concepts/security.rst | 20 +++++++++---------- user_guide_src/source/concepts/structure.rst | 2 ++ .../source/incoming/incomingrequest.rst | 2 ++ user_guide_src/source/libraries/sessions.rst | 2 ++ 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index 7efc051a49cd..c3bbdb6de504 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -38,8 +38,8 @@ OWASP recommendations CodeIgniter provisions ====================== -- :doc:`HTTP library <../incoming/incomingrequest>` provides for input field filtering & content metadata -- Validation library +- :doc:`HTTP library <../incoming/incomingrequest>` provides for :ref:`input field filtering ` & content metadata +- :doc:`../libraries/validation` library ********************************************* A2 Weak authentication and session management @@ -81,8 +81,8 @@ OWASP recommendations CodeIgniter provisions ====================== -- esc function -- Validation library +- :php:func:`esc()` function +- :doc:`../libraries/validation` library *********************************** A4 Insecure Direct Object Reference @@ -103,7 +103,7 @@ OWASP recommendations CodeIgniter provisions ====================== -- Validation library +- :doc:`../libraries/validation` library - Easy to add third party authentication **************************** @@ -144,7 +144,7 @@ OWASP recommendations CodeIgniter provisions ====================== -- Session keys stored encrypted +- :doc:`Session <../libraries/sessions>` keys stored encrypted **************************************** A7 Missing Function Level Access Control @@ -165,8 +165,8 @@ OWASP recommendations CodeIgniter provisions ====================== -- Public folder, with application and system outside -- :doc:`Security ` library provides for CSRF validation +- :ref:`Public ` folder, with application and system outside +- :doc:`Security ` library provides for :ref:`CSRF validation ` ************************************ A8 Cross Site Request Forgery (CSRF) @@ -185,7 +185,7 @@ OWASP recommendations CodeIgniter provisions ====================== -- :doc:`Security ` library provides for CSRF validation +- :doc:`Security ` library provides for :ref:`CSRF validation ` ********************************************** A9 Using Components with Known Vulnerabilities @@ -222,4 +222,4 @@ CodeIgniter provisions ====================== - :doc:`HTTP library <../incoming/incomingrequest>` provides for ... -- :doc:`Session <../libraries/sessions>` library provides flashdata +- :doc:`Session <../libraries/sessions>` library provides :ref:`sessions-flashdata` diff --git a/user_guide_src/source/concepts/structure.rst b/user_guide_src/source/concepts/structure.rst index e0a754c69512..5e2084556380 100644 --- a/user_guide_src/source/concepts/structure.rst +++ b/user_guide_src/source/concepts/structure.rst @@ -58,6 +58,8 @@ extend the classes, or create new classes, to provide the desired functionality. All files in this directory live under the ``CodeIgniter`` namespace. +.. _application-structure-public: + public ====== diff --git a/user_guide_src/source/incoming/incomingrequest.rst b/user_guide_src/source/incoming/incomingrequest.rst index 96b0428e5a09..ed3c40ec7f2b 100644 --- a/user_guide_src/source/incoming/incomingrequest.rst +++ b/user_guide_src/source/incoming/incomingrequest.rst @@ -173,6 +173,8 @@ You can also use ``getRawInputVar()``, to get the specified variable from raw st .. literalinclude:: incomingrequest/039.php +.. _incomingrequest-filtering-input-data: + Filtering Input Data ==================== diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 6c6b75abe0a5..c7c94b75bb2e 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -214,6 +214,8 @@ This method also accepts an array of item keys to unset: .. literalinclude:: sessions/018.php +.. _sessions-flashdata: + Flashdata ========= From 5985268da6ae153120e82eeeef17e228068c9f05 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 Mar 2023 11:02:23 +0900 Subject: [PATCH 002/237] docs: add Shield --- user_guide_src/source/concepts/security.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index c3bbdb6de504..856a6d4522f7 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -62,6 +62,7 @@ CodeIgniter provisions - :doc:`Session <../libraries/sessions>` library - :doc:`Security ` library provides for CSRF validation +- An official authentication and authorization framework :ref:`CodeIgniter Shield ` - Easy to add third party authentication ***************************** @@ -104,6 +105,7 @@ CodeIgniter provisions ====================== - :doc:`../libraries/validation` library +- An official authentication and authorization framework :ref:`CodeIgniter Shield ` - Easy to add third party authentication **************************** From 1f05c692a49da22344bbf706d45d3aeb2246bf5e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 28 Mar 2023 11:02:41 +0900 Subject: [PATCH 003/237] docs: add CSP support --- user_guide_src/source/concepts/security.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index 856a6d4522f7..39c925cb68ae 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -84,6 +84,7 @@ CodeIgniter provisions - :php:func:`esc()` function - :doc:`../libraries/validation` library +- Support for :ref:`content-security-policy` *********************************** A4 Insecure Direct Object Reference From df6ccd1d3b19b1042132758721c77462b4cc37f9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 17:54:37 +0900 Subject: [PATCH 004/237] docs: add items --- user_guide_src/source/concepts/security.rst | 3 ++- user_guide_src/source/incoming/filters.rst | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index 39c925cb68ae..bfcddf3f250e 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -38,8 +38,9 @@ OWASP recommendations CodeIgniter provisions ====================== -- :doc:`HTTP library <../incoming/incomingrequest>` provides for :ref:`input field filtering ` & content metadata +- :ref:`invalidchars` filter - :doc:`../libraries/validation` library +- :doc:`HTTP library <../incoming/incomingrequest>` provides for :ref:`input field filtering ` & content metadata ********************************************* A2 Weak authentication and session management diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst index cab286cf95fc..cfd55df420a0 100644 --- a/user_guide_src/source/incoming/filters.rst +++ b/user_guide_src/source/incoming/filters.rst @@ -204,6 +204,8 @@ The filters bundled with CodeIgniter4 are: :doc:`Honeypot <../libraries/honeypot .. note:: The filters are executed in the order defined in the config file. However, if enabled, ``DebugToolbar`` is always executed last because it should be able to capture everything that happens in the other filters. +.. _invalidchars: + InvalidChars ============= From ca3e3ad72446516e4642e93a2ee9622d0d5bbe39 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 17:54:57 +0900 Subject: [PATCH 005/237] docs: remove item that do not make sense --- user_guide_src/source/concepts/security.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index bfcddf3f250e..185595202c42 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -148,7 +148,6 @@ OWASP recommendations CodeIgniter provisions ====================== -- :doc:`Session <../libraries/sessions>` keys stored encrypted **************************************** A7 Missing Function Level Access Control From 2679f74e10a723e9902a49c2f1f974693aeec693 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 17:55:34 +0900 Subject: [PATCH 006/237] docs: add items --- user_guide_src/source/concepts/security.rst | 4 ++++ user_guide_src/source/database/configuration.rst | 2 ++ 2 files changed, 6 insertions(+) diff --git a/user_guide_src/source/concepts/security.rst b/user_guide_src/source/concepts/security.rst index 185595202c42..208131703f74 100644 --- a/user_guide_src/source/concepts/security.rst +++ b/user_guide_src/source/concepts/security.rst @@ -148,6 +148,10 @@ OWASP recommendations CodeIgniter provisions ====================== +- The config for global secure access (``Config\App::$forceGlobalSecureRequests``) +- :php:func:`force_https()` function +- :doc:`../libraries/encryption` +- The :ref:`database config ` (``encrypt``) **************************************** A7 Missing Function Level Access Control diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index ae0605d0a81d..bdb6320d0bb3 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -132,6 +132,8 @@ and decode it in the constructor in the Config class: .. literalinclude:: configuration/009.php +.. _database-config-explanation-of-values: + ********************** Explanation of Values: ********************** From 8ddb9908c5e7c0ad715b2eee593235393d8a051a Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 21:20:51 +0900 Subject: [PATCH 007/237] docs: fix incorrect sample code --- user_guide_src/source/helpers/inflector_helper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index bc24d2842b38..aed13dc61e41 100755 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -94,7 +94,7 @@ The following functions are available: Takes multiple words in camelCase or PascalCase and converts them to snake_case. Example: - .. literalinclude:: inflector_helper/007.php + .. literalinclude:: inflector_helper/014.php .. php:function:: humanize($string[, $separator = '_']) From 0abe958e5fc5a5c5948ea0dec9a50999593319f6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 21:55:54 +0900 Subject: [PATCH 008/237] docs: add sub sections and reorganize --- user_guide_src/source/cli/spark_commands.rst | 88 ++++++++++++-------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/user_guide_src/source/cli/spark_commands.rst b/user_guide_src/source/cli/spark_commands.rst index 8ac2ecba1d6a..f4011f9bec3d 100644 --- a/user_guide_src/source/cli/spark_commands.rst +++ b/user_guide_src/source/cli/spark_commands.rst @@ -6,7 +6,7 @@ CodeIgniter ships with the official command **spark** and built-in commands. .. contents:: :local: - :depth: 2 + :depth: 3 **************** Running Commands @@ -16,12 +16,42 @@ Running via CLI =============== The commands are run from the command line, in the project root directory. -The command file **spark** has been provided that is used to run any of the CLI commands:: +The command file **spark** has been provided that is used to run any of the CLI commands. + +Showing List of Commands +------------------------ + +When called **spark** without specifying a command, a simple help page is displayed +that also provides a list of available commands and their descriptions, sorted by +categories:: > php spark -When called without specifying a command, a simple help page is displayed that also provides a list of -available commands. +spark list +^^^^^^^^^^ + +``php spark`` is the exactly same as the ``list`` command:: + + > php spark list + +You may also use the ``--simple`` option to get a raw list of all available commands, +sorted alphabetically:: + + > php spark list --simple + +Showing Help +------------ + +You can get help about any CLI command using the ``help`` command as follows:: + + > php spark help db:seed + +Since v4.3.0, you can also use the ``--help`` option instead of the ``help`` command:: + + > php spark db:seed --help + +Running a Command +----------------- You should pass the name of the command as the first argument to run that command:: @@ -31,17 +61,31 @@ Some commands take additional arguments, which should be provided directly after > php spark db:seed DevUserSeeder -You may always pass ``--no-header`` to suppress the header output, helpful for parsing results:: - - > php spark cache:clear --no-header - For all of the commands CodeIgniter provides, if you do not provide the required arguments, you will be prompted for the information it needs to run correctly:: - > php spark make::controller + > php spark make:controller Controller class name : +Suppressing Header Output +------------------------- + +When you run a command, the header with CodeIgniter version and the current time +is output:: + + > php spark env + + CodeIgniter v4.3.5 Command Line Tool - Server Time: 2023-06-16 12:45:31 UTC+00:00 + + Your environment is currently set as development. + +You may always pass ``--no-header`` to suppress the header output, helpful for parsing results:: + + > php spark env --no-header + + Your environment is currently set as development. + Calling Commands ================ @@ -55,29 +99,3 @@ it from the command line. All output from the command that is ran is captured when not run from the command line. It is returned from the command so that you can choose to display it or not. - -****************** -Using Help Command -****************** - -spark help -========== - -You can get help about any CLI command using the ``help`` command as follows:: - - > php spark help db:seed - -Since v4.3.0, you can also use the ``--help`` option instead of the ``help`` command:: - - > php spark db:seed --help - -spark list -========== - -Use the ``list`` command to get a list of available commands and their descriptions, sorted by categories:: - - > php spark list - -You may also use the ``--simple`` option to get a raw list of all available commands, sorted alphabetically:: - - > php spark list --simple From aaf95afd37fe2012f27b94729163323e75afa891 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 17 Jun 2023 09:51:59 +0900 Subject: [PATCH 009/237] docs: update old session config names --- user_guide_src/source/libraries/sessions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 6c6b75abe0a5..fd4011342334 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -435,7 +435,7 @@ Preference Default Opti unexpected results or be changed in the future. Please configure everything properly. -.. note:: If ``sessionExpiration`` is set to ``0``, the ``session.gc_maxlifetime`` +.. note:: If ``expiration`` is set to ``0``, the ``session.gc_maxlifetime`` setting set by PHP in session management will be used as-is (often the default value of ``1440``). This needs to be changed in ``php.ini`` or via ``ini_set()`` as needed. @@ -597,10 +597,10 @@ For PostgreSQL:: You will also need to add a PRIMARY KEY **depending on your $matchIP setting**. The examples below work both on MySQL and PostgreSQL:: - // When sessionMatchIP = true + // When $matchIP = true ALTER TABLE ci_sessions ADD PRIMARY KEY (id, ip_address); - // When sessionMatchIP = false + // When $matchIP = false ALTER TABLE ci_sessions ADD PRIMARY KEY (id); // To drop a previously created primary key (use when changing the setting) From 855d528abf6a673b23fece029c498b5e3fda6594 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 17 Jun 2023 09:52:27 +0900 Subject: [PATCH 010/237] docs: add "// ..." in sample code --- user_guide_src/source/libraries/sessions/040.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/libraries/sessions/040.php b/user_guide_src/source/libraries/sessions/040.php index 386c83a0293b..9ae54d0b6968 100644 --- a/user_guide_src/source/libraries/sessions/040.php +++ b/user_guide_src/source/libraries/sessions/040.php @@ -9,4 +9,6 @@ class Session extends BaseConfig { // ... public ?string $DBGroup = 'groupName'; + + // ... } From fb269be6e788812a410c43b6cd2437786361714d Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 17 Jun 2023 09:53:49 +0900 Subject: [PATCH 011/237] docs: fix letter upper/lower cases --- user_guide_src/source/libraries/sessions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index fd4011342334..17db10cfd57b 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -39,7 +39,7 @@ but does not take any configuration options. .. literalinclude:: sessions/002.php -How do Sessions work? +How Do Sessions Work? ===================== When a page is loaded, the session class will check to see if a valid @@ -59,7 +59,7 @@ automatic. .. note:: Under CLI, the Session library will automatically halt itself, as this is a concept based entirely on the HTTP protocol. -A note about concurrency +A Note about Concurrency ------------------------ Unless you're developing a website with heavy AJAX usage, you can skip this @@ -627,7 +627,7 @@ RedisHandler Driver .. note:: Since Redis doesn't have a locking mechanism exposed, locks for this driver are emulated by a separate value that is kept for up - to 300 seconds. With ``v4.3.2`` or above, You can connect ``Redis`` with **TLS** protocol. + to 300 seconds. With ``v4.3.2`` or above, you can connect ``Redis`` with **TLS** protocol. Redis is a storage engine typically used for caching and popular because of its high performance, which is also probably your reason to use the From 92e6fa39701439b7e4f130c15f2ff2f960f1ed2c Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 21:14:52 +0900 Subject: [PATCH 012/237] docs: update sample code Spark command is recommended. --- user_guide_src/source/cli/cli_library/001.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/cli/cli_library/001.php b/user_guide_src/source/cli/cli_library/001.php index e42c9a9231e6..45f025b1c08f 100644 --- a/user_guide_src/source/cli/cli_library/001.php +++ b/user_guide_src/source/cli/cli_library/001.php @@ -1,11 +1,16 @@ Date: Fri, 16 Jun 2023 09:00:36 +0900 Subject: [PATCH 013/237] docs: add sub section titles --- user_guide_src/source/database/queries.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index 35d8c5ad08df..b3904418b8a6 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -15,11 +15,16 @@ Query Basics Regular Queries =============== -To submit a query, use the **query** function: +.. _db-query: + +$db->query() +------------ + +To submit a query, use the ``query()`` method: .. literalinclude:: queries/001.php -The ``query()`` function returns a database result **object** when "read" +The ``query()`` method returns a database result **object** when "read" type queries are run which you can use to :doc:`show your results `. When "write" type queries are run it simply returns true or false depending on success or failure. When retrieving @@ -34,6 +39,11 @@ this: Simplified Queries ================== +.. _db-simplequery: + +$db->simpleQuery() +------------------ + The ``simpleQuery()`` method is a simplified version of the ``$db->query()`` method. It DOES NOT return a database result set, nor does it set the query timer, or From 8bae53b7dc06bd11530d8b8c3b24c47662eea3a9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 16 Jun 2023 09:01:03 +0900 Subject: [PATCH 014/237] docs: improve explanation about Model pagination --- .../source/libraries/pagination.rst | 29 ++++++++++++++++--- .../source/libraries/pagination/003.php | 3 +- .../source/libraries/pagination/016.php | 20 +++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 user_guide_src/source/libraries/pagination/016.php diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index a32e88fdb378..17a9f02985f4 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -39,13 +39,34 @@ The first element is the results from the database, **users**, which is retrieve the Model will hold on to the instance it used and store it in the public property, ``$pager``. So, we grab that and assign it to the ``$pager`` variable in the view. -.. important:: It is important to understand that the ``Model::paginate()`` method uses the **Model** and **QueryBuilder** methods. - Therefore, trying to use ``$db->query()`` and ``Model::paginate()`` **will not work** because ``$db->query()`` executes - the query immediately and is not associated with a QueryBuilder. +Customizing Query for Pagination +================================ -To define conditions for pagination in a model, you can: +To customize a query for pagination in a model, you can add +:doc:`Query Builder <../database/query_builder>` methods before ``paginate()`` +method. + +To add WHERE conditions: .. literalinclude:: pagination/003.php + :lines: 2- + +You can join another table: + +.. literalinclude:: pagination/016.php + :lines: 2- + +.. important:: It is important to understand that the ``Model::paginate()`` method + uses the **Model** and the **Query Builder** instance in the Model. + Therefore, trying to use ``Model::paginate()`` with :ref:`db-query` + **will not work** because ``$db->query()`` executes the query immediately + and is not associated with the Query Builder. + +If you need a complicated SQL query that you cannot write with Query Builder, +try using :ref:`db-query` and `Manual Pagination`_. + +Displaying Pager Links +====================== Within the view, we then need to tell it where to display the resulting links:: diff --git a/user_guide_src/source/libraries/pagination/003.php b/user_guide_src/source/libraries/pagination/003.php index 423adc232c19..b6bd2cd415f1 100644 --- a/user_guide_src/source/libraries/pagination/003.php +++ b/user_guide_src/source/libraries/pagination/003.php @@ -9,9 +9,10 @@ ]; // You can move the conditions to a separate method. -// Model method class UserModel extends Model { + // ... + public function banned() { $this->builder()->where('ban', 1); diff --git a/user_guide_src/source/libraries/pagination/016.php b/user_guide_src/source/libraries/pagination/016.php new file mode 100644 index 000000000000..b867b2243a77 --- /dev/null +++ b/user_guide_src/source/libraries/pagination/016.php @@ -0,0 +1,20 @@ +builder() + ->select('news.*, category.name') + ->join('category', 'news.category_id = category.id'); + + return [ + 'news' => $this->paginate($perPage), + 'pager' => $this->pager, + ]; + } +} From 30bda4ff1dd1481bcda7085a94613e8cbc21027f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 17 Jun 2023 09:12:34 +0900 Subject: [PATCH 015/237] docs: replace Controller with BaseController --- user_guide_src/source/libraries/pagination/002.php | 4 +--- user_guide_src/source/libraries/pagination/004.php | 4 +--- user_guide_src/source/libraries/pagination/015.php | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/user_guide_src/source/libraries/pagination/002.php b/user_guide_src/source/libraries/pagination/002.php index c8cd31ebec5c..c1bc432220d8 100644 --- a/user_guide_src/source/libraries/pagination/002.php +++ b/user_guide_src/source/libraries/pagination/002.php @@ -2,9 +2,7 @@ namespace App\Controllers; -use CodeIgniter\Controller; - -class UserController extends Controller +class UserController extends BaseController { public function index() { diff --git a/user_guide_src/source/libraries/pagination/004.php b/user_guide_src/source/libraries/pagination/004.php index 75eb88c3e409..a8ef4d296125 100644 --- a/user_guide_src/source/libraries/pagination/004.php +++ b/user_guide_src/source/libraries/pagination/004.php @@ -2,9 +2,7 @@ namespace App\Controllers; -use CodeIgniter\Controller; - -class UserController extends Controller +class UserController extends BaseController { public function index() { diff --git a/user_guide_src/source/libraries/pagination/015.php b/user_guide_src/source/libraries/pagination/015.php index e6ea3e86ca87..ac9f4fc430f0 100644 --- a/user_guide_src/source/libraries/pagination/015.php +++ b/user_guide_src/source/libraries/pagination/015.php @@ -2,9 +2,7 @@ namespace App\Controllers; -use CodeIgniter\Controller; - -class UserController extends Controller +class UserController extends BaseController { public function index() { From 041d2bc7cd2dfccd1cf0128f9980301cddd0147f Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 17 Jun 2023 09:13:23 +0900 Subject: [PATCH 016/237] docs: improve sample code and description --- .../source/libraries/pagination.rst | 16 +++++++++++++-- .../source/libraries/pagination/003.php | 20 +------------------ .../source/libraries/pagination/016.php | 4 ++++ .../source/libraries/pagination/017.php | 17 ++++++++++++++++ .../source/libraries/pagination/018.php | 9 +++++++++ 5 files changed, 45 insertions(+), 21 deletions(-) create mode 100644 user_guide_src/source/libraries/pagination/017.php create mode 100644 user_guide_src/source/libraries/pagination/018.php diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 17a9f02985f4..3cf6f01dadbb 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -46,15 +46,27 @@ To customize a query for pagination in a model, you can add :doc:`Query Builder <../database/query_builder>` methods before ``paginate()`` method. -To add WHERE conditions: +Adding WHERE +------------ + +If you want to add WHERE conditions, you can specify conditions directly: .. literalinclude:: pagination/003.php :lines: 2- +You can move the conditions to a separate method: + +.. literalinclude:: pagination/017.php + +.. literalinclude:: pagination/018.php + :lines: 2- + +Adding JOIN +----------- + You can join another table: .. literalinclude:: pagination/016.php - :lines: 2- .. important:: It is important to understand that the ``Model::paginate()`` method uses the **Model** and the **Query Builder** instance in the Model. diff --git a/user_guide_src/source/libraries/pagination/003.php b/user_guide_src/source/libraries/pagination/003.php index b6bd2cd415f1..6ea631c7a9bc 100644 --- a/user_guide_src/source/libraries/pagination/003.php +++ b/user_guide_src/source/libraries/pagination/003.php @@ -1,27 +1,9 @@ $model->where('ban', 1)->paginate(10), 'pager' => $model->pager, ]; - -// You can move the conditions to a separate method. -class UserModel extends Model -{ - // ... - - public function banned() - { - $this->builder()->where('ban', 1); - - return $this; // This will allow the call chain to be used. - } -} - -$data = [ - 'users' => $model->banned()->paginate(10), - 'pager' => $model->pager, -]; diff --git a/user_guide_src/source/libraries/pagination/016.php b/user_guide_src/source/libraries/pagination/016.php index b867b2243a77..64be257b4152 100644 --- a/user_guide_src/source/libraries/pagination/016.php +++ b/user_guide_src/source/libraries/pagination/016.php @@ -1,5 +1,9 @@ builder()->where('ban', 1); + + return $this; // This will allow the call chain to be used. + } +} diff --git a/user_guide_src/source/libraries/pagination/018.php b/user_guide_src/source/libraries/pagination/018.php new file mode 100644 index 000000000000..002d034a643c --- /dev/null +++ b/user_guide_src/source/libraries/pagination/018.php @@ -0,0 +1,9 @@ + $model->banned()->paginate(10), + 'pager' => $model->pager, +]; From 9c3637a6af6bb6cfc8c57fa87f55d0d8920e3cdc Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 15 Jun 2023 17:37:35 +0900 Subject: [PATCH 017/237] refactor: remove unused property --- system/Encryption/Handlers/BaseHandler.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/system/Encryption/Handlers/BaseHandler.php b/system/Encryption/Handlers/BaseHandler.php index 64195672439e..894cb81d30cf 100644 --- a/system/Encryption/Handlers/BaseHandler.php +++ b/system/Encryption/Handlers/BaseHandler.php @@ -13,20 +13,12 @@ use CodeIgniter\Encryption\EncrypterInterface; use Config\Encryption; -use Psr\Log\LoggerInterface; /** * Base class for encryption handling */ abstract class BaseHandler implements EncrypterInterface { - /** - * Logger instance to record error messages and warnings. - * - * @var LoggerInterface - */ - protected $logger; - /** * Constructor */ From 1877269f5bba6c1156002b71f4560b94dd232d9e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 18 Jun 2023 08:27:17 +0900 Subject: [PATCH 018/237] chore: update Kint to 5.0.6 --- system/ThirdParty/Kint/Utils.php | 4 ++++ system/ThirdParty/Kint/resources/compiled/rich.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/system/ThirdParty/Kint/Utils.php b/system/ThirdParty/Kint/Utils.php index b51b33558501..78b5a1e8c5ca 100644 --- a/system/ThirdParty/Kint/Utils.php +++ b/system/ThirdParty/Kint/Utils.php @@ -150,6 +150,10 @@ public static function composerGetExtras(string $key = 'kint'): array */ public static function composerSkipFlags(): void { + if (\defined('KINT_SKIP_FACADE') && \defined('KINT_SKIP_HELPERS')) { + return; + } + $extras = self::composerGetExtras(); if (!empty($extras['disable-facade']) && !\defined('KINT_SKIP_FACADE')) { diff --git a/system/ThirdParty/Kint/resources/compiled/rich.js b/system/ThirdParty/Kint/resources/compiled/rich.js index c02e3fe2b1ab..39db8fb92021 100644 --- a/system/ThirdParty/Kint/resources/compiled/rich.js +++ b/system/ThirdParty/Kint/resources/compiled/rich.js @@ -1 +1 @@ -void 0===window.kintRich&&(window.kintRich=function(){"use strict";var l={selectText:function(e){var t=window.getSelection(),a=document.createRange();a.selectNodeContents(e),t.removeAllRanges(),t.addRange(a)},toggle:function(e,t){var a=l.getChildren(e);a&&(e.classList.toggle("kint-show",t),1===a.childNodes.length)&&(a=a.childNodes[0].childNodes[0])&&a.classList&&a.classList.contains("kint-parent")&&l.toggle(a,t)},toggleChildren:function(e,t){var a=l.getChildren(e);if(a){var o=a.getElementsByClassName("kint-parent"),s=o.length;for(void 0===t&&(t=e.classList.contains("kint-show"));s--;)l.toggle(o[s],t)}},switchTab:function(e){var t=e.previousSibling,a=0;for(e.parentNode.getElementsByClassName("kint-active-tab")[0].classList.remove("kint-active-tab"),e.classList.add("kint-active-tab");t;)1===t.nodeType&&a++,t=t.previousSibling;for(var o=e.parentNode.nextSibling.childNodes,s=0;s"},openInNewWindow:function(e){var t=window.open();t&&(t.document.open(),t.document.write(l.mktag("html")+l.mktag("head")+l.mktag("title")+"Kint ("+(new Date).toISOString()+")"+l.mktag("/title")+l.mktag('meta charset="utf-8"')+l.mktag('script class="kint-rich-script" nonce="'+l.script.nonce+'"')+l.script.innerHTML+l.mktag("/script")+l.mktag('style class="kint-rich-style" nonce="'+l.style.nonce+'"')+l.style.innerHTML+l.mktag("/style")+l.mktag("/head")+l.mktag("body")+'
'+e.parentNode.outerHTML+"
"+l.mktag("/body")),t.document.close())},sortTable:function(e,a){var t=e.tBodies[0];[].slice.call(e.tBodies[0].rows).sort(function(e,t){if(e=e.cells[a].textContent.trim().toLocaleLowerCase(),t=t.cells[a].textContent.trim().toLocaleLowerCase(),isNaN(e)||isNaN(t)){if(isNaN(e)&&!isNaN(t))return 1;if(isNaN(t)&&!isNaN(e))return-1}else e=parseFloat(e),t=parseFloat(t);return eli:not(.kint-active-tab)").forEach(function(e){l.isFolderOpen()&&!l.folder.contains(e)||0===e.offsetWidth&&0===e.offsetHeight||l.keyboardNav.targets.push(e)}),e&&-1!==l.keyboardNav.targets.indexOf(e)&&(l.keyboardNav.target=l.keyboardNav.targets.indexOf(e))},sync:function(e){var t=document.querySelector(".kint-focused");t&&t.classList.remove("kint-focused"),l.keyboardNav.active&&((t=l.keyboardNav.targets[l.keyboardNav.target]).classList.add("kint-focused"),e||l.keyboardNav.scroll(t))},scroll:function(e){var t,a;e!==l.folder.querySelector("dt > nav")&&(e=(t=function(e){return e.offsetTop+(e.offsetParent?t(e.offsetParent):0)})(e),l.isFolderOpen()?(a=l.folder.querySelector("dd.kint-foldout")).scrollTo(0,e-a.clientHeight/2):window.scrollTo(0,e-window.innerHeight/2))},moveCursor:function(e){for(l.keyboardNav.target+=e;l.keyboardNav.target<0;)l.keyboardNav.target+=l.keyboardNav.targets.length;for(;l.keyboardNav.target>=l.keyboardNav.targets.length;)l.keyboardNav.target-=l.keyboardNav.targets.length;l.keyboardNav.sync()},setCursor:function(e){if(!l.isFolderOpen()||l.folder.contains(e)){l.keyboardNav.fetchTargets();for(var t=0;t"},openInNewWindow:function(e){var t=window.open();t&&(t.document.open(),t.document.write(l.mktag("html")+l.mktag("head")+l.mktag("title")+"Kint ("+(new Date).toISOString()+")"+l.mktag("/title")+l.mktag('meta charset="utf-8"')+l.mktag('script class="kint-rich-script" nonce="'+l.script.nonce+'"')+l.script.innerHTML+l.mktag("/script")+l.mktag('style class="kint-rich-style" nonce="'+l.style.nonce+'"')+l.style.innerHTML+l.mktag("/style")+l.mktag("/head")+l.mktag("body")+'
'+e.parentNode.outerHTML+"
"+l.mktag("/body")),t.document.close())},sortTable:function(e,a){var t=e.tBodies[0];[].slice.call(e.tBodies[0].rows).sort(function(e,t){if(e=e.cells[a].textContent.trim().toLocaleLowerCase(),t=t.cells[a].textContent.trim().toLocaleLowerCase(),isNaN(e)||isNaN(t)){if(isNaN(e)&&!isNaN(t))return 1;if(isNaN(t)&&!isNaN(e))return-1}else e=parseFloat(e),t=parseFloat(t);return eli:not(.kint-active-tab)").forEach(function(e){l.isFolderOpen()&&!l.folder.contains(e)||0===e.offsetWidth&&0===e.offsetHeight||l.keyboardNav.targets.push(e)}),e&&-1!==l.keyboardNav.targets.indexOf(e)&&(l.keyboardNav.target=l.keyboardNav.targets.indexOf(e))},sync:function(e){var t=document.querySelector(".kint-focused");t&&t.classList.remove("kint-focused"),l.keyboardNav.active&&((t=l.keyboardNav.targets[l.keyboardNav.target]).classList.add("kint-focused"),e||l.keyboardNav.scroll(t))},scroll:function(e){var t,a;l.folder&&e===l.folder.querySelector("dt > nav")||(e=(t=function(e){return e.offsetTop+(e.offsetParent?t(e.offsetParent):0)})(e),l.isFolderOpen()?(a=l.folder.querySelector("dd.kint-foldout")).scrollTo(0,e-a.clientHeight/2):window.scrollTo(0,e-window.innerHeight/2))},moveCursor:function(e){for(l.keyboardNav.target+=e;l.keyboardNav.target<0;)l.keyboardNav.target+=l.keyboardNav.targets.length;for(;l.keyboardNav.target>=l.keyboardNav.targets.length;)l.keyboardNav.target-=l.keyboardNav.targets.length;l.keyboardNav.sync()},setCursor:function(e){if(!l.isFolderOpen()||l.folder.contains(e)){l.keyboardNav.fetchTargets();for(var t=0;t Date: Sun, 18 Jun 2023 08:40:01 +0900 Subject: [PATCH 019/237] docs: change version number notation For consistency. --- user_guide_src/source/changelogs/v4.1.1.rst | 2 +- user_guide_src/source/installation/upgrade_4210.rst | 2 +- user_guide_src/source/installation/upgrade_4211.rst | 2 +- user_guide_src/source/installation/upgrade_4212.rst | 2 +- user_guide_src/source/installation/upgrade_423.rst | 2 +- user_guide_src/source/installation/upgrade_425.rst | 2 +- user_guide_src/source/installation/upgrade_427.rst | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.1.1.rst b/user_guide_src/source/changelogs/v4.1.1.rst index aeccef6e3c41..a12c64cffef3 100644 --- a/user_guide_src/source/changelogs/v4.1.1.rst +++ b/user_guide_src/source/changelogs/v4.1.1.rst @@ -14,7 +14,7 @@ Bugs Fixed - Fixed an issue where ``.gitattributes`` was preventing framework downloads. -Note that this fix was also applied retroactively to ``4.0.5`` on the **framework** repo. +Note that this fix was also applied retroactively to 4.0.5 on the **framework** repo. See the repo's `CHANGELOG_4.1.md `_ diff --git a/user_guide_src/source/installation/upgrade_4210.rst b/user_guide_src/source/installation/upgrade_4210.rst index d6f7b18f6b19..02fc0f85139a 100644 --- a/user_guide_src/source/installation/upgrade_4210.rst +++ b/user_guide_src/source/installation/upgrade_4210.rst @@ -15,7 +15,7 @@ Please refer to the upgrade instructions corresponding to your installation meth Project Files ************* -Version ``4.2.10`` did not alter any executable code in project files. +Version 4.2.10 did not alter any executable code in project files. All Changes =========== diff --git a/user_guide_src/source/installation/upgrade_4211.rst b/user_guide_src/source/installation/upgrade_4211.rst index bc5dbc51d1cc..be8ed1e5bbcb 100644 --- a/user_guide_src/source/installation/upgrade_4211.rst +++ b/user_guide_src/source/installation/upgrade_4211.rst @@ -55,7 +55,7 @@ If the following values exceed those maximum length, the session will not work p Project Files ************* -Version ``4.2.11`` did not alter any executable code in project files. +Version 4.2.11 did not alter any executable code in project files. All Changes =========== diff --git a/user_guide_src/source/installation/upgrade_4212.rst b/user_guide_src/source/installation/upgrade_4212.rst index ff6005d641d3..98c325a83618 100644 --- a/user_guide_src/source/installation/upgrade_4212.rst +++ b/user_guide_src/source/installation/upgrade_4212.rst @@ -15,7 +15,7 @@ Please refer to the upgrade instructions corresponding to your installation meth Project Files ************* -Version ``4.2.12`` did not alter any executable code in project files. +Version 4.2.12 did not alter any executable code in project files. All Changes =========== diff --git a/user_guide_src/source/installation/upgrade_423.rst b/user_guide_src/source/installation/upgrade_423.rst index c78ddb38d77b..c1066abbd761 100644 --- a/user_guide_src/source/installation/upgrade_423.rst +++ b/user_guide_src/source/installation/upgrade_423.rst @@ -15,4 +15,4 @@ Please refer to the upgrade instructions corresponding to your installation meth Project Files ************* -Version ``4.2.3`` is an internal change for security measures and requires no intervention in projects. +Version 4.2.3 is an internal change for security measures and requires no intervention in projects. diff --git a/user_guide_src/source/installation/upgrade_425.rst b/user_guide_src/source/installation/upgrade_425.rst index 930f188c811d..02efbeb858b2 100644 --- a/user_guide_src/source/installation/upgrade_425.rst +++ b/user_guide_src/source/installation/upgrade_425.rst @@ -15,4 +15,4 @@ Please refer to the upgrade instructions corresponding to your installation meth Project Files ************* -Version ``4.2.5`` did not alter any project files. +Version 4.2.5 did not alter any project files. diff --git a/user_guide_src/source/installation/upgrade_427.rst b/user_guide_src/source/installation/upgrade_427.rst index eb4e3ae5cc7f..c730cc9302dc 100644 --- a/user_guide_src/source/installation/upgrade_427.rst +++ b/user_guide_src/source/installation/upgrade_427.rst @@ -58,7 +58,7 @@ Others Project Files ************* -Version ``4.2.7`` did not alter any executable code in project files. +Version 4.2.7 did not alter any executable code in project files. All Changes =========== From c225c8523e5b1909fb2faec2ae55d24afcc3622b Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 18 Jun 2023 08:43:27 +0900 Subject: [PATCH 020/237] docs: small updates --- admin/RELEASE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/RELEASE.md b/admin/RELEASE.md index d052ee1dcb0e..f5059e71b205 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -85,7 +85,7 @@ the existing content. * Title: `4.x.x Ready code` * Description: blank * Merge the PR then create a new Release: - * Version: `v4.x.x` + * Tag: `v4.x.x` (Create new tag) * Target: `master` * Title: `CodeIgniter 4.x.x` * Description: @@ -97,7 +97,7 @@ the existing content. ## New Contributors * - Full Changelog: https://github.com/codeigniter4/CodeIgniter4/compare/v4.x.x...v4.x.x + **Full Changelog**: https://github.com/codeigniter4/CodeIgniter4/compare/v4.x.x...v4.x.x ``` * Watch for the "Deploy Distributable Repos" action to make sure **framework**, **appstarter**, and **userguide** get updated From 75bb53afd60eb87d9c7ecad4736eb7a52f04f2fb Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 18 Jun 2023 08:51:05 +0900 Subject: [PATCH 021/237] docs: add changelog/upgrade guide for v4.3.7 --- user_guide_src/source/changelogs/index.rst | 1 + user_guide_src/source/changelogs/v4.3.7.rst | 29 +++++++++++ .../source/installation/upgrade_437.rst | 50 +++++++++++++++++++ .../source/installation/upgrading.rst | 1 + 4 files changed, 81 insertions(+) create mode 100644 user_guide_src/source/changelogs/v4.3.7.rst create mode 100644 user_guide_src/source/installation/upgrade_437.rst diff --git a/user_guide_src/source/changelogs/index.rst b/user_guide_src/source/changelogs/index.rst index f1d8427dc42b..4959a51ea9c3 100644 --- a/user_guide_src/source/changelogs/index.rst +++ b/user_guide_src/source/changelogs/index.rst @@ -12,6 +12,7 @@ See all the changes. .. toctree:: :titlesonly: + v4.3.7 v4.3.6 v4.3.5 v4.3.4 diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst new file mode 100644 index 000000000000..b167c0c48dcf --- /dev/null +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -0,0 +1,29 @@ +Version 4.3.7 +############# + +Release Date: Unreleased + +**4.3.7 release of CodeIgniter4** + +.. contents:: + :local: + :depth: 3 + +BREAKING +******** + +Message Changes +*************** + +Changes +******* + +Deprecations +************ + +Bugs Fixed +********** + +See the repo's +`CHANGELOG.md `_ +for a complete list of bugs fixed. diff --git a/user_guide_src/source/installation/upgrade_437.rst b/user_guide_src/source/installation/upgrade_437.rst new file mode 100644 index 000000000000..f9917deecfe5 --- /dev/null +++ b/user_guide_src/source/installation/upgrade_437.rst @@ -0,0 +1,50 @@ +############################# +Upgrading from 4.3.6 to 4.3.6 +############################# + +Please refer to the upgrade instructions corresponding to your installation method. + +- :ref:`Composer Installation App Starter Upgrading ` +- :ref:`Composer Installation Adding CodeIgniter4 to an Existing Project Upgrading ` +- :ref:`Manual Installation Upgrading ` + +.. contents:: + :local: + :depth: 2 + +Mandatory File Changes +********************** + +Breaking Changes +**************** + +Breaking Enhancements +********************* + +Project Files +************* + +Some files in the **project space** (root, app, public, writable) received updates. Due to +these files being outside of the **system** scope they will not be changed without your intervention. + +There are some third-party CodeIgniter modules available to assist with merging changes to +the project space: `Explore on Packagist `_. + +Content Changes +=============== + +The following files received significant changes (including deprecations or visual adjustments) +and it is recommended that you merge the updated versions with your application: + +Config +------ + +- @TODO + +All Changes +=========== + +This is a list of all files in the **project space** that received changes; +many will be simple comments or formatting that have no effect on the runtime: + +- @TODO diff --git a/user_guide_src/source/installation/upgrading.rst b/user_guide_src/source/installation/upgrading.rst index 6b411b767044..a44aac6cd044 100644 --- a/user_guide_src/source/installation/upgrading.rst +++ b/user_guide_src/source/installation/upgrading.rst @@ -16,6 +16,7 @@ See also :doc:`./backward_compatibility_notes`. backward_compatibility_notes + upgrade_437 upgrade_436 upgrade_435 upgrade_434 From 843f509f9e7089b92c36752be6dce4ccd1fbfc4f Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 08:18:14 +0900 Subject: [PATCH 022/237] docs: fix typo Co-authored-by: Michal Sniatala --- user_guide_src/source/installation/upgrade_437.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_437.rst b/user_guide_src/source/installation/upgrade_437.rst index f9917deecfe5..36cac74545d7 100644 --- a/user_guide_src/source/installation/upgrade_437.rst +++ b/user_guide_src/source/installation/upgrade_437.rst @@ -1,5 +1,5 @@ ############################# -Upgrading from 4.3.6 to 4.3.6 +Upgrading from 4.3.6 to 4.3.7 ############################# Please refer to the upgrade instructions corresponding to your installation method. From 6675e7794905cc98ab1c9eff8aef59eb2d1a0129 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 08:59:06 +0900 Subject: [PATCH 023/237] style: composer cs-fix Update for PHP CS Fixer 3.18.0. --- tests/system/ControllerTest.php | 1 - .../Database/Live/SQLite/AlterTableTest.php | 1 - tests/system/I18n/TimeLegacyTest.php | 20 +++++++++---------- tests/system/I18n/TimeTest.php | 20 +++++++++---------- .../Handlers/Database/RedisHandlerTest.php | 1 - 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/tests/system/ControllerTest.php b/tests/system/ControllerTest.php index 50660dbe4641..00c03a5abc0e 100644 --- a/tests/system/ControllerTest.php +++ b/tests/system/ControllerTest.php @@ -23,7 +23,6 @@ use Config\Services; use Config\Validation as ValidationConfig; use Psr\Log\LoggerInterface; -use Tests\Support\Config\Validation; /** * Exercise our core Controller class. diff --git a/tests/system/Database/Live/SQLite/AlterTableTest.php b/tests/system/Database/Live/SQLite/AlterTableTest.php index a88812b93ddc..d29d09e32e0c 100644 --- a/tests/system/Database/Live/SQLite/AlterTableTest.php +++ b/tests/system/Database/Live/SQLite/AlterTableTest.php @@ -12,7 +12,6 @@ namespace CodeIgniter\Database\Live\SQLite; use CodeIgniter\Database\Exceptions\DataException; -use CodeIgniter\Database\SQLite3\Connection; use CodeIgniter\Database\SQLite3\Forge; use CodeIgniter\Database\SQLite3\Table; use CodeIgniter\Test\CIUnitTestCase; diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index b839ef4c506c..8fb19f6582ce 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -1125,16 +1125,16 @@ public function testGetter() } // @TODO Uncomment when PHP 8.2.4 Segmentation fault fixed. -// public function testUnserializeTimeObject() -// { -// $time1 = new TimeLegacy('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); -// $timeCache = serialize($time1); -// $time2 = unserialize($timeCache); -// -// $this->assertInstanceOf(TimeLegacy::class, $time2); -// $this->assertTrue($time2->equals($time1)); -// $this->assertNotSame($time1, $time2); -// } + // public function testUnserializeTimeObject() + // { + // $time1 = new TimeLegacy('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); + // $timeCache = serialize($time1); + // $time2 = unserialize($timeCache); + // + // $this->assertInstanceOf(TimeLegacy::class, $time2); + // $this->assertTrue($time2->equals($time1)); + // $this->assertNotSame($time1, $time2); + // } public function testSetTestNowWithFaLocale() { diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index deac2760ac81..8db1edd4207b 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -1128,16 +1128,16 @@ public function testGetter() } // @TODO Uncomment when PHP 8.2.4 Segmentation fault fixed. -// public function testUnserializeTimeObject() -// { -// $time1 = new Time('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); -// $timeCache = serialize($time1); -// $time2 = unserialize($timeCache); -// -// $this->assertInstanceOf(Time::class, $time2); -// $this->assertTrue($time2->equals($time1)); -// $this->assertNotSame($time1, $time2); -// } + // public function testUnserializeTimeObject() + // { + // $time1 = new Time('August 28, 2020 10:04:00pm', 'Asia/Manila', 'en'); + // $timeCache = serialize($time1); + // $time2 = unserialize($timeCache); + // + // $this->assertInstanceOf(Time::class, $time2); + // $this->assertTrue($time2->equals($time1)); + // $this->assertNotSame($time1, $time2); + // } public function testSetTestNowWithTimeZone() { diff --git a/tests/system/Session/Handlers/Database/RedisHandlerTest.php b/tests/system/Session/Handlers/Database/RedisHandlerTest.php index b5d67a768c47..08505afbdf13 100644 --- a/tests/system/Session/Handlers/Database/RedisHandlerTest.php +++ b/tests/system/Session/Handlers/Database/RedisHandlerTest.php @@ -16,7 +16,6 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\App as AppConfig; use Config\Session as SessionConfig; -use Redis; /** * @group DatabaseLive From f3ef6c2e633a2eb29cb289ab7931c65d088d8b94 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 09:43:07 +0900 Subject: [PATCH 024/237] docs: remove unneeded "// ..." --- user_guide_src/source/libraries/sessions/040.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/libraries/sessions/040.php b/user_guide_src/source/libraries/sessions/040.php index 9ae54d0b6968..386c83a0293b 100644 --- a/user_guide_src/source/libraries/sessions/040.php +++ b/user_guide_src/source/libraries/sessions/040.php @@ -9,6 +9,4 @@ class Session extends BaseConfig { // ... public ?string $DBGroup = 'groupName'; - - // ... } From eb4121284db9acef33f497d97c8725adb0f70e09 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 09:44:01 +0900 Subject: [PATCH 025/237] docs: add sub section titles --- user_guide_src/source/libraries/sessions.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 17db10cfd57b..9119fe1423db 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -559,6 +559,9 @@ However, there are some conditions that must be met: Configure DatabaseHandler ------------------------- +Setting Table Name +^^^^^^^^^^^^^^^^^^ + In order to use the 'DatabaseHandler' session driver, you must also create this table that we already mentioned and then set it as your ``$savePath`` value. @@ -567,6 +570,9 @@ you would do this: .. literalinclude:: sessions/039.php +Creating Database Table +^^^^^^^^^^^^^^^^^^^^^^^ + And then of course, create the database table ... For MySQL:: @@ -594,6 +600,9 @@ For PostgreSQL:: and the session ID and a delimiter. It should be increased as needed, for example, when using long session IDs. +Adding Primary Key +^^^^^^^^^^^^^^^^^^ + You will also need to add a PRIMARY KEY **depending on your $matchIP setting**. The examples below work both on MySQL and PostgreSQL:: @@ -611,6 +620,9 @@ You can choose the Database group to use by adding a new line to the .. literalinclude:: sessions/040.php +Setting Up Database Table with Command +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + If you'd rather not do all of this by hand, you can use the ``make:migration --session`` command from the cli to generate a migration file for you:: From 658c517b77576f5f902d57a05da1ed9af94e84d6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 09:46:15 +0900 Subject: [PATCH 026/237] docs: add important note --- user_guide_src/source/libraries/sessions.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 9119fe1423db..50e14ebf4ff0 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -615,6 +615,11 @@ setting**. The examples below work both on MySQL and PostgreSQL:: // To drop a previously created primary key (use when changing the setting) ALTER TABLE ci_sessions DROP PRIMARY KEY; +.. important:: If you don't add the correct primary key, the following error + may occur:: + + Uncaught mysqli_sql_exception: Duplicate entry 'ci_session:***' for key 'ci_sessions.PRIMARY' + You can choose the Database group to use by adding a new line to the **app/Config/Session.php** file with the name of the group to use: From 963526a5179af0b0c294b538c4dc2e9ab12f4135 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 09:47:49 +0900 Subject: [PATCH 027/237] docs: update description There is already $DBGroup in the config file. --- user_guide_src/source/libraries/sessions.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 50e14ebf4ff0..3be10a013ddd 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -620,8 +620,12 @@ setting**. The examples below work both on MySQL and PostgreSQL:: Uncaught mysqli_sql_exception: Duplicate entry 'ci_session:***' for key 'ci_sessions.PRIMARY' -You can choose the Database group to use by adding a new line to the -**app/Config/Session.php** file with the name of the group to use: +Changing Database Group +^^^^^^^^^^^^^^^^^^^^^^^ + +The default database group is used by default. +You can change the database group to use by changing the ``$DBGroup`` property +in the **app/Config/Session.php** file to the name of the group to use: .. literalinclude:: sessions/040.php From 6a8c20e1ca74d0649bf3a79e5bbb885506492120 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 17:08:12 +0900 Subject: [PATCH 028/237] test: add test to check param count is reset --- tests/system/Test/FeatureTestAutoRoutingImprovedTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php index 897697146fb5..19481a2860d3 100644 --- a/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php +++ b/tests/system/Test/FeatureTestAutoRoutingImprovedTest.php @@ -72,4 +72,13 @@ public function testCallPost() $response->assertSee('Saved'); } + + public function testCallParamsCount() + { + $response = $this->post('newautorouting/save/1/a/b'); + $response->assertSee('Saved'); + + $response = $this->get('newautorouting'); + $response->assertSee('Hello'); + } } From f39530ac57c747bb7bffbbcbed8df84374145733 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 17:09:07 +0900 Subject: [PATCH 029/237] fix: reset params for HTTP testing A previous test result causes an params count error in HTTP testing. --- system/Router/AutoRouterImproved.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/Router/AutoRouterImproved.php b/system/Router/AutoRouterImproved.php index 6f2aa1af5ece..42fe18e937af 100644 --- a/system/Router/AutoRouterImproved.php +++ b/system/Router/AutoRouterImproved.php @@ -106,6 +106,9 @@ public function getRoute(string $uri, string $httpVerb): array { $httpVerb = strtolower($httpVerb); + // Reset Controller method params. + $this->params = []; + $defaultMethod = $httpVerb . ucfirst($this->defaultMethod); $this->method = $defaultMethod; From edd820436e3d03640cf8d293f4906ebb6bfaf297 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 17:34:15 +0900 Subject: [PATCH 030/237] docs: fix incorrect PHPDoc types --- system/Test/TestResponse.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Test/TestResponse.php b/system/Test/TestResponse.php index 700b27ef4f54..62706158617b 100644 --- a/system/Test/TestResponse.php +++ b/system/Test/TestResponse.php @@ -350,7 +350,7 @@ public function assertCookieExpired(string $key, string $prefix = '') /** * Returns the response's body as JSON * - * @return false|string|null + * @return false|string */ public function getJSON() { @@ -385,7 +385,7 @@ public function assertJSONFragment(array $fragment, bool $strict = false) * Asserts that the JSON exactly matches the passed in data. * If the value being passed in is a string, it must be a json_encoded string. * - * @param array|string $test + * @param array|object|string $test * * @throws Exception */ From dbfd8ff6edeab4e9bd19f6a046d017f3df96375d Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 18:18:27 +0900 Subject: [PATCH 031/237] test: change test method names Add the method name to test. --- tests/system/Test/TestResponseTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 84275808a71b..0291c8cd665a 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -305,7 +305,7 @@ public function testGetJSON() $this->assertSame($formatter->format(['foo' => 'bar']), $this->testResponse->getJSON()); } - public function testEmptyJSON() + public function testGetJSONEmptyJSON() { $this->getTestResponse('

Hello World

'); $this->response->setJSON('', true); @@ -314,7 +314,7 @@ public function testEmptyJSON() $this->assertSame('""', $this->testResponse->getJSON()); } - public function testFalseJSON() + public function testGetJSONFalseJSON() { $this->getTestResponse('

Hello World

'); $this->response->setJSON(false, true); @@ -323,7 +323,7 @@ public function testFalseJSON() $this->assertSame('false', $this->testResponse->getJSON()); } - public function testTrueJSON() + public function testGetJSONTrueJSON() { $this->getTestResponse('

Hello World

'); $this->response->setJSON(true, true); @@ -332,7 +332,7 @@ public function testTrueJSON() $this->assertSame('true', $this->testResponse->getJSON()); } - public function testInvalidJSON() + public function testGetJSONInvalidJSON() { $tmp = ' test " case '; $this->getTestResponse('

Hello World

'); @@ -350,7 +350,7 @@ public function testGetXML() $this->assertSame($formatter->format(['foo' => 'bar']), $this->testResponse->getXML()); } - public function testJsonFragment() + public function testAssertJSONFragment() { $this->getTestResponse([ 'config' => [ @@ -383,7 +383,7 @@ public function testAssertJSONFragmentFailsGracefullyWhenNotGivenJson() $this->testResponse->assertJSONFragment(['foo' => 'bar']); } - public function testJsonExact() + public function testAssertJsonExactArray() { $data = [ 'config' => [ @@ -397,7 +397,7 @@ public function testJsonExact() $this->testResponse->assertJSONExact($data); } - public function testJsonExactString() + public function testAssertJsonExactString() { $data = [ 'config' => [ From e5343329058b2055ff0cf0e4da818d623e4dd17e Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 18:19:16 +0900 Subject: [PATCH 032/237] test: add param type for Response body --- tests/system/Test/TestResponseTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 0291c8cd665a..1159de9ead41 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -412,7 +412,7 @@ public function testAssertJsonExactString() $this->testResponse->assertJSONExact($formatter->format($data)); } - protected function getTestResponse($body = null, array $responseOptions = [], array $headers = []) + protected function getTestResponse(?string $body = null, array $responseOptions = [], array $headers = []) { $this->response = new Response(new App()); $this->response->setBody($body); From 66526a8d5ea29082b3e28fad0622ec4327d5f372 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 18:29:29 +0900 Subject: [PATCH 033/237] fix: incorrect tests Cannot set non-string to Response body. --- tests/system/Test/TestResponseTest.php | 36 ++++++++++++++++---------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 1159de9ead41..0b01c52a0bb9 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -299,10 +299,12 @@ public function testAssertCookieExpired() public function testGetJSON() { - $this->getTestResponse(['foo' => 'bar']); - $formatter = Services::format()->getFormatter('application/json'); + $data = ['foo' => 'bar']; + $this->getTestResponse(''); + $this->response->setJSON($data, true); - $this->assertSame($formatter->format(['foo' => 'bar']), $this->testResponse->getJSON()); + $formatter = Services::format()->getFormatter('application/json'); + $this->assertSame($formatter->format($data), $this->testResponse->getJSON()); } public function testGetJSONEmptyJSON() @@ -344,20 +346,24 @@ public function testGetJSONInvalidJSON() public function testGetXML() { - $this->getTestResponse(['foo' => 'bar']); - $formatter = Services::format()->getFormatter('application/xml'); + $data = ['foo' => 'bar']; + $this->getTestResponse(''); + $this->response->setXML($data); - $this->assertSame($formatter->format(['foo' => 'bar']), $this->testResponse->getXML()); + $formatter = Services::format()->getFormatter('application/xml'); + $this->assertSame($formatter->format($data), $this->testResponse->getXML()); } public function testAssertJSONFragment() { - $this->getTestResponse([ + $data = [ 'config' => [ 'key-a', 'key-b', ], - ]); + ]; + $this->getTestResponse(''); + $this->response->setJSON($data, true); $this->testResponse->assertJSONFragment(['config' => ['key-a']]); $this->testResponse->assertJSONFragment(['config' => ['key-a']], true); @@ -365,9 +371,11 @@ public function testAssertJSONFragment() public function testAssertJSONFragmentFollowingAssertArraySubset() { - $this->getTestResponse([ + $data = [ 'config' => '124', - ]); + ]; + $this->getTestResponse(''); + $this->response->setJSON($data, true); $this->testResponse->assertJSONFragment(['config' => 124]); // must fail on strict $this->testResponse->assertJSONFragment(['config' => '124'], true); @@ -391,8 +399,8 @@ public function testAssertJsonExactArray() 'key-b', ], ]; - - $this->getTestResponse($data); + $this->getTestResponse(''); + $this->response->setJSON($data, true); $this->testResponse->assertJSONExact($data); } @@ -405,10 +413,10 @@ public function testAssertJsonExactString() 'key-b', ], ]; + $this->getTestResponse(''); + $this->response->setJSON($data, true); - $this->getTestResponse($data); $formatter = Services::format()->getFormatter('application/json'); - $this->testResponse->assertJSONExact($formatter->format($data)); } From 2bcebad8e3412387161500641701e1c3aecb3303 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 18:35:23 +0900 Subject: [PATCH 034/237] test: remove testCallWithJsonRequestObject() and add testAssertJsonExactObject() testCallWithJsonRequestObject() is not a test for FeatureTestTrait. --- tests/system/Test/FeatureTestTraitTest.php | 14 -------------- tests/system/Test/TestResponseTest.php | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index d622a00aaedf..0d0237301f98 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -372,20 +372,6 @@ public function testCallWithJsonRequest() $response->assertJSONExact(['foo' => 'bar']); } - public function testCallWithJsonRequestObject() - { - $this->withRoutes([ - [ - 'post', - 'home', - '\Tests\Support\Controllers\Popcorn::echoJson', - ], - ]); - $response = $this->withBodyFormat('json')->call('post', 'home', ['foo' => 'bar']); - $response->assertOK(); - $response->assertJSONExact((object) ['foo' => 'bar']); - } - public function testSetupRequestBodyWithParams() { $request = $this->setupRequest('post', 'home'); diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 0b01c52a0bb9..8abc71c6d9ed 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -405,6 +405,20 @@ public function testAssertJsonExactArray() $this->testResponse->assertJSONExact($data); } + public function testAssertJsonExactObject() + { + $data = (object) [ + 'config' => [ + 'key-a', + 'key-b', + ], + ]; + $this->getTestResponse(''); + $this->response->setJSON($data, true); + + $this->testResponse->assertJSONExact($data); + } + public function testAssertJsonExactString() { $data = [ From 202b4678834d4d92442b2c78c27e1428dea10669 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 19 Jun 2023 18:36:46 +0900 Subject: [PATCH 035/237] docs: fix @param types --- system/Format/FormatterInterface.php | 2 +- system/HTTP/ResponseTrait.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/Format/FormatterInterface.php b/system/Format/FormatterInterface.php index 277299eea2b9..6e8e9bd50384 100644 --- a/system/Format/FormatterInterface.php +++ b/system/Format/FormatterInterface.php @@ -19,7 +19,7 @@ interface FormatterInterface /** * Takes the given data and formats it. * - * @param array|string $data + * @param array|object|string $data * * @return false|string */ diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 133d1b193b3b..7fe5f7c2a87c 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -239,7 +239,7 @@ public function setContentType(string $mime, string $charset = 'UTF-8') /** * Converts the $body into JSON and sets the Content Type header. * - * @param array|string $body + * @param array|object|string $body * * @return $this */ @@ -304,8 +304,8 @@ public function getXML() * Handles conversion of the data into the appropriate format, * and sets the correct Content-Type header for our response. * - * @param array|string $body - * @param string $format Valid: json, xml + * @param array|object|string $body + * @param string $format Valid: json, xml * * @return mixed * From 3e92760a7e6d52dc96c235b7f66a5fea8b014f36 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 14:01:48 +0900 Subject: [PATCH 036/237] docs: update Valid HTTP protocol version --- user_guide_src/source/incoming/message.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index a575a4aa2765..8fa74bab9d15 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -160,6 +160,7 @@ Class Reference :returns: The current message instance :rtype: CodeIgniter\\HTTP\\Message - Sets the HTTP protocol version this Message uses. Valid values are ``1.0``, ``1.1`` and ``2.0``: + Sets the HTTP protocol version this Message uses. Valid values are + ``1.0``, ``1.1``, ``2.0`` and ``3.0``: .. literalinclude:: message/010.php From 4fd6ea0cd28e14b3a6d3d0e594b95a50f4da3a1f Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 14:02:20 +0900 Subject: [PATCH 037/237] docs: fix incorrect description --- user_guide_src/source/incoming/message.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 8fa74bab9d15..2609c0b5fb07 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -151,8 +151,8 @@ Class Reference :returns: The current HTTP protocol version :rtype: string - Returns the message's current HTTP protocol. If none has been set, will return ``null``. - Acceptable values are ``1.0``, ``1.1`` and ``2.0``. + Returns the message's current HTTP protocol. If none has been set, will + return ``1.1``. .. php:method:: setProtocolVersion($version) From 33f2db46b20795731bc6151a315d051b974f911d Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 22 Jun 2023 11:55:10 +0800 Subject: [PATCH 038/237] chore: add Composer\Config::disableProcessTimeout --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index 08c6d72d8d18..674e51659808 100644 --- a/composer.json +++ b/composer.json @@ -83,11 +83,13 @@ "sa": "@analyze", "test": "phpunit", "cs": [ + "Composer\\Config::disableProcessTimeout", "php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php", "php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.no-header.php", "php-cs-fixer fix --ansi --verbose --dry-run --diff" ], "cs-fix": [ + "Composer\\Config::disableProcessTimeout", "php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.user-guide.php", "php-cs-fixer fix --ansi --verbose --diff --config=.php-cs-fixer.no-header.php", "php-cs-fixer fix --ansi --verbose --diff" From 56f345fdf8c8faa1d2335f4666ebc9c630be7cac Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 23 Jun 2023 12:00:02 +0800 Subject: [PATCH 039/237] fix: change assertion on CLITest::testWaitZero --- tests/system/CLI/CLITest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 9381c414cae4..0e8ed4db73a3 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -73,7 +73,7 @@ public function testWaitZero() $time = time(); CLI::wait(0); - $this->assertSame(0, time() - $time); + $this->assertCloseEnough(0, time() - $time); PhpStreamWrapper::restore(); } From 3bdb53f3740f5adf52807a93bc09e337310261c4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 24 Jun 2023 09:20:24 +0900 Subject: [PATCH 040/237] refactor: use ::class to config() param --- system/CLI/BaseCommand.php | 3 +- system/CLI/GeneratorTrait.php | 3 +- system/Cache/Handlers/BaseHandler.php | 3 +- system/CodeIgniter.php | 6 +- system/Commands/Cache/ClearCache.php | 3 +- system/Commands/Cache/InfoCache.php | 3 +- system/Commands/Database/CreateDatabase.php | 5 +- .../Generators/MigrationGenerator.php | 11 ++-- .../Generators/SessionMigrationGenerator.php | 6 +- system/Commands/Utilities/Routes.php | 3 +- .../Utilities/Routes/FilterCollector.php | 3 +- .../Utilities/Routes/FilterFinder.php | 3 +- system/Config/BaseConfig.php | 2 +- system/Config/BaseService.php | 4 +- system/Config/Factories.php | 2 +- system/Config/Services.php | 58 ++++++++++--------- system/Controller.php | 3 +- system/Database/Config.php | 5 +- system/Database/Migration.php | 2 +- system/Database/MigrationRunner.php | 4 +- system/Debug/Toolbar/Collectors/Config.php | 3 +- system/Debug/Toolbar/Collectors/Database.php | 3 +- system/Encryption/Handlers/BaseHandler.php | 2 +- system/Events/Events.php | 3 +- system/Filters/Filters.php | 2 +- system/HTTP/CURLRequest.php | 4 +- system/HTTP/ContentSecurityPolicy.php | 3 +- system/HTTP/DownloadResponse.php | 3 +- system/HTTP/RequestTrait.php | 3 +- system/HTTP/Response.php | 3 +- system/HTTP/ResponseTrait.php | 2 +- system/HTTP/URI.php | 3 +- system/Helpers/cookie_helper.php | 4 +- system/Helpers/form_helper.php | 8 ++- system/Helpers/url_helper.php | 10 ++-- system/Publisher/Publisher.php | 3 +- system/Router/RouteCollection.php | 3 +- system/Router/Router.php | 8 ++- system/Security/Security.php | 4 +- system/Session/Handlers/BaseHandler.php | 4 +- system/Session/Handlers/DatabaseHandler.php | 2 +- system/Session/Handlers/MemcachedHandler.php | 2 +- system/Session/Handlers/RedisHandler.php | 2 +- system/Session/Session.php | 4 +- system/Test/CIUnitTestCase.php | 5 +- system/Test/ControllerTestTrait.php | 2 +- system/Test/ControllerTester.php | 2 +- system/Test/Fabricator.php | 3 +- system/Test/FeatureTestCase.php | 3 +- system/Test/FilterTestTrait.php | 2 +- system/Typography/Typography.php | 4 +- system/View/ViewDecoratorTrait.php | 3 +- 52 files changed, 136 insertions(+), 108 deletions(-) diff --git a/system/CLI/BaseCommand.php b/system/CLI/BaseCommand.php index 0618ceb237f7..0c4abd2cea98 100644 --- a/system/CLI/BaseCommand.php +++ b/system/CLI/BaseCommand.php @@ -11,6 +11,7 @@ namespace CodeIgniter\CLI; +use Config\Exceptions; use Psr\Log\LoggerInterface; use ReflectionException; use Throwable; @@ -121,7 +122,7 @@ protected function showError(Throwable $e) { $exception = $e; $message = $e->getMessage(); - $config = config('Exceptions'); + $config = config(Exceptions::class); require $config->errorViewPath . '/cli/error_exception.php'; } diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 21ae0c165d8a..7b6066380739 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -11,6 +11,7 @@ namespace CodeIgniter\CLI; +use Config\Generators; use Config\Services; use Throwable; @@ -267,7 +268,7 @@ protected function qualifyClassName(): string protected function renderTemplate(array $data = []): string { try { - return view(config('Generators')->views[$this->name], $data, ['debug' => false]); + return view(config(Generators::class)->views[$this->name], $data, ['debug' => false]); } catch (Throwable $e) { log_message('error', (string) $e); diff --git a/system/Cache/Handlers/BaseHandler.php b/system/Cache/Handlers/BaseHandler.php index 0c5ef170c9e0..9f700370fc8a 100644 --- a/system/Cache/Handlers/BaseHandler.php +++ b/system/Cache/Handlers/BaseHandler.php @@ -13,6 +13,7 @@ use Closure; use CodeIgniter\Cache\CacheInterface; +use Config\Cache; use Exception; use InvalidArgumentException; @@ -61,7 +62,7 @@ public static function validateKey($key, $prefix = ''): string throw new InvalidArgumentException('Cache key cannot be empty.'); } - $reserved = config('Cache')->reservedCharacters ?? self::RESERVED_CHARACTERS; + $reserved = config(Cache::class)->reservedCharacters ?? self::RESERVED_CHARACTERS; if ($reserved && strpbrk($key, $reserved) !== false) { throw new InvalidArgumentException('Cache key contains reserved characters ' . $reserved); } diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 829b65ea952b..2a777474c56e 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -28,6 +28,7 @@ use CodeIgniter\Router\Router; use Config\App; use Config\Cache; +use Config\Feature; use Config\Kint as KintConfig; use Config\Services; use Exception; @@ -268,7 +269,6 @@ private function autoloadKint(): void private function configureKint(): void { - /** @var \Config\Kint $config */ $config = config(KintConfig::class); Kint::$depth_limit = $config->maxDepth; @@ -455,7 +455,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache // If any filters were specified within the routes file, // we need to ensure it's active for the current request if ($routeFilter !== null) { - $multipleFiltersEnabled = config('Feature')->multipleFilters ?? false; + $multipleFiltersEnabled = config(Feature::class)->multipleFilters ?? false; if ($multipleFiltersEnabled) { $filters->enableFilters($routeFilter, 'before'); $filters->enableFilters($routeFilter, 'after'); @@ -822,7 +822,7 @@ protected function tryToRouteIt(?RouteCollectionInterface $routes = null) $this->benchmark->stop('routing'); // for backward compatibility - $multipleFiltersEnabled = config('Feature')->multipleFilters ?? false; + $multipleFiltersEnabled = config(Feature::class)->multipleFilters ?? false; if (! $multipleFiltersEnabled) { return $this->router->getFilter(); } diff --git a/system/Commands/Cache/ClearCache.php b/system/Commands/Cache/ClearCache.php index 648d99e42ecc..b903425ba795 100644 --- a/system/Commands/Cache/ClearCache.php +++ b/system/Commands/Cache/ClearCache.php @@ -14,6 +14,7 @@ use CodeIgniter\Cache\CacheFactory; use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; +use Config\Cache; /** * Clears current cache. @@ -62,7 +63,7 @@ class ClearCache extends BaseCommand */ public function run(array $params) { - $config = config('Cache'); + $config = config(Cache::class); $handler = $params[0] ?? $config->handler; if (! array_key_exists($handler, $config->validHandlers)) { diff --git a/system/Commands/Cache/InfoCache.php b/system/Commands/Cache/InfoCache.php index db5a51d76f91..1dc2504b0fb4 100644 --- a/system/Commands/Cache/InfoCache.php +++ b/system/Commands/Cache/InfoCache.php @@ -15,6 +15,7 @@ use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; use CodeIgniter\I18n\Time; +use Config\Cache; /** * Shows information on the cache. @@ -54,7 +55,7 @@ class InfoCache extends BaseCommand */ public function run(array $params) { - $config = config('Cache'); + $config = config(Cache::class); helper('number'); if ($config->handler !== 'file') { diff --git a/system/Commands/Database/CreateDatabase.php b/system/Commands/Database/CreateDatabase.php index a3922bd66dee..d103d97f689a 100644 --- a/system/Commands/Database/CreateDatabase.php +++ b/system/Commands/Database/CreateDatabase.php @@ -82,10 +82,7 @@ public function run(array $params) } try { - /** - * @var Database $config - */ - $config = config('Database'); + $config = config(Database::class); // Set to an empty database to prevent connection errors. $group = ENVIRONMENT === 'testing' ? 'tests' : $config->defaultGroup; diff --git a/system/Commands/Generators/MigrationGenerator.php b/system/Commands/Generators/MigrationGenerator.php index 817c16885205..5ffd259ec479 100644 --- a/system/Commands/Generators/MigrationGenerator.php +++ b/system/Commands/Generators/MigrationGenerator.php @@ -15,6 +15,8 @@ use CodeIgniter\CLI\CLI; use CodeIgniter\CLI\GeneratorTrait; use Config\App as AppConfig; +use Config\Database; +use Config\Migrations; use Config\Session as SessionConfig; /** @@ -107,12 +109,11 @@ protected function prepare(string $class): string $data['session'] = true; $data['table'] = is_string($table) ? $table : 'ci_sessions'; $data['DBGroup'] = is_string($DBGroup) ? $DBGroup : 'default'; - $data['DBDriver'] = config('Database')->{$data['DBGroup']}['DBDriver']; + $data['DBDriver'] = config(Database::class)->{$data['DBGroup']}['DBDriver']; - /** @var AppConfig $config */ - $config = config('App'); + $config = config(AppConfig::class); /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); $data['matchIP'] = ($session instanceof SessionConfig) ? $session->matchIP : $config->sessionMatchIP; @@ -126,6 +127,6 @@ protected function prepare(string $class): string */ protected function basename(string $filename): string { - return gmdate(config('Migrations')->timestampFormat) . basename($filename); + return gmdate(config(Migrations::class)->timestampFormat) . basename($filename); } } diff --git a/system/Commands/Generators/SessionMigrationGenerator.php b/system/Commands/Generators/SessionMigrationGenerator.php index fbfb2d3db1ff..a04527e866d1 100644 --- a/system/Commands/Generators/SessionMigrationGenerator.php +++ b/system/Commands/Generators/SessionMigrationGenerator.php @@ -14,6 +14,8 @@ use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; use CodeIgniter\CLI\GeneratorTrait; +use Config\App; +use Config\Migrations; /** * Generates a migration file for database sessions. @@ -93,7 +95,7 @@ protected function prepare(string $class): string $data['session'] = true; $data['table'] = $this->getOption('t'); $data['DBGroup'] = $this->getOption('g'); - $data['matchIP'] = config('App')->sessionMatchIP ?? false; + $data['matchIP'] = config(App::class)->sessionMatchIP ?? false; $data['table'] = is_string($data['table']) ? $data['table'] : 'ci_sessions'; $data['DBGroup'] = is_string($data['DBGroup']) ? $data['DBGroup'] : 'default'; @@ -106,6 +108,6 @@ protected function prepare(string $class): string */ protected function basename(string $filename): string { - return gmdate(config('Migrations')->timestampFormat) . basename($filename); + return gmdate(config(Migrations::class)->timestampFormat) . basename($filename); } } diff --git a/system/Commands/Utilities/Routes.php b/system/Commands/Utilities/Routes.php index bcd5825c649e..4ee18331f781 100644 --- a/system/Commands/Utilities/Routes.php +++ b/system/Commands/Utilities/Routes.php @@ -18,6 +18,7 @@ use CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\AutoRouteCollector as AutoRouteCollectorImproved; use CodeIgniter\Commands\Utilities\Routes\FilterCollector; use CodeIgniter\Commands\Utilities\Routes\SampleURIGenerator; +use Config\Feature; use Config\Services; /** @@ -124,7 +125,7 @@ public function run(array $params) } if ($collection->shouldAutoRoute()) { - $autoRoutesImproved = config('Feature')->autoRoutesImproved ?? false; + $autoRoutesImproved = config(Feature::class)->autoRoutesImproved ?? false; if ($autoRoutesImproved) { $autoRouteCollector = new AutoRouteCollectorImproved( diff --git a/system/Commands/Utilities/Routes/FilterCollector.php b/system/Commands/Utilities/Routes/FilterCollector.php index 630416749115..71bbd1b083b3 100644 --- a/system/Commands/Utilities/Routes/FilterCollector.php +++ b/system/Commands/Utilities/Routes/FilterCollector.php @@ -15,6 +15,7 @@ use CodeIgniter\Filters\Filters; use CodeIgniter\HTTP\Request; use CodeIgniter\Router\Router; +use Config\Filters as FiltersConfig; /** * Collects filters for a route. @@ -72,7 +73,7 @@ private function createRouter(Request $request): Router private function createFilters(Request $request): Filters { - $config = config('Filters'); + $config = config(FiltersConfig::class); return new Filters($config, $request, Services::response()); } diff --git a/system/Commands/Utilities/Routes/FilterFinder.php b/system/Commands/Utilities/Routes/FilterFinder.php index 0f25eebf47f1..042b3a269838 100644 --- a/system/Commands/Utilities/Routes/FilterFinder.php +++ b/system/Commands/Utilities/Routes/FilterFinder.php @@ -15,6 +15,7 @@ use CodeIgniter\Filters\Filters; use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\Router; +use Config\Feature; use Config\Services; /** @@ -35,7 +36,7 @@ private function getRouteFilters(string $uri): array { $this->router->handle($uri); - $multipleFiltersEnabled = config('Feature')->multipleFilters ?? false; + $multipleFiltersEnabled = config(Feature::class)->multipleFilters ?? false; if (! $multipleFiltersEnabled) { $filter = $this->router->getFilter(); diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index 300e9ffac5f9..80ae268635ef 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -59,7 +59,7 @@ class BaseConfig */ public function __construct() { - static::$moduleConfig = config('Modules'); + static::$moduleConfig = config(Modules::class); $this->registerProperties(); diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index 6b72b6ff2ce8..d517691b0c1f 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -318,7 +318,7 @@ public static function injectMock(string $name, $mock) protected static function discoverServices(string $name, array $arguments) { if (! static::$discovered) { - $config = config('Modules'); + $config = config(Modules::class); if ($config->shouldDiscover('services')) { $locator = static::locator(); @@ -360,7 +360,7 @@ protected static function discoverServices(string $name, array $arguments) protected static function buildServicesCache(): void { if (! static::$discovered) { - $config = config('Modules'); + $config = config(Modules::class); if ($config->shouldDiscover('services')) { $locator = static::locator(); diff --git a/system/Config/Factories.php b/system/Config/Factories.php index d752f55c506e..222df063196a 100644 --- a/system/Config/Factories.php +++ b/system/Config/Factories.php @@ -230,7 +230,7 @@ public static function getOptions(string $component): array // Handle Config as a special case to prevent logic loops ? self::$configOptions // Load values from the best Factory configuration (will include Registrars) - : config('Factory')->{$component} ?? []; + : config(Factory::class)->{$component} ?? []; return self::setOptions($component, $values); } diff --git a/system/Config/Services.php b/system/Config/Services.php index a2d13c40e80c..a47faf9c53ed 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -61,6 +61,7 @@ use CodeIgniter\View\View; use Config\App; use Config\Cache; +use Config\ContentSecurityPolicy as ContentSecurityPolicyConfig; use Config\ContentSecurityPolicy as CSPConfig; use Config\Database; use Config\Email as EmailConfig; @@ -70,8 +71,11 @@ use Config\Format as FormatConfig; use Config\Honeypot as HoneypotConfig; use Config\Images; +use Config\Logger as LoggerConfig; use Config\Migrations; +use Config\Modules; use Config\Pager as PagerConfig; +use Config\Paths; use Config\Services as AppServices; use Config\Session as SessionConfig; use Config\Toolbar as ToolbarConfig; @@ -129,7 +133,7 @@ public static function clirequest(?App $config = null, bool $getShared = true) return static::getSharedInstance('clirequest', $config); } - $config ??= config('App'); + $config ??= config(App::class); return new CLIRequest($config); } @@ -145,7 +149,7 @@ public static function codeigniter(?App $config = null, bool $getShared = true) return static::getSharedInstance('codeigniter', $config); } - $config ??= config('App'); + $config ??= config(App::class); return new CodeIgniter($config); } @@ -175,7 +179,7 @@ public static function csp(?CSPConfig $config = null, bool $getShared = true) return static::getSharedInstance('csp', $config); } - $config ??= config('ContentSecurityPolicy'); + $config ??= config(ContentSecurityPolicyConfig::class); return new ContentSecurityPolicy($config); } @@ -192,7 +196,7 @@ public static function curlrequest(array $options = [], ?ResponseInterface $resp return static::getSharedInstance('curlrequest', $options, $response, $config); } - $config ??= config('App'); + $config ??= config(App::class); $response ??= new Response($config); return new CURLRequest( @@ -217,7 +221,7 @@ public static function email($config = null, bool $getShared = true) } if (empty($config) || ! (is_array($config) || $config instanceof EmailConfig)) { - $config = config('Email'); + $config = config(EmailConfig::class); } return new Email($config); @@ -236,7 +240,7 @@ public static function encrypter(?EncryptionConfig $config = null, $getShared = return static::getSharedInstance('encrypter', $config); } - $config ??= config('Encryption'); + $config ??= config(EncryptionConfig::class); $encryption = new Encryption($config); return $encryption->initialize($config); @@ -261,7 +265,7 @@ public static function exceptions( return static::getSharedInstance('exceptions', $config, $request, $response); } - $config ??= config('Exceptions'); + $config ??= config(ExceptionsConfig::class); $request ??= AppServices::request(); $response ??= AppServices::response(); @@ -282,7 +286,7 @@ public static function filters(?FiltersConfig $config = null, bool $getShared = return static::getSharedInstance('filters', $config); } - $config ??= config('Filters'); + $config ??= config(FiltersConfig::class); return new Filters($config, AppServices::request(), AppServices::response()); } @@ -298,7 +302,7 @@ public static function format(?FormatConfig $config = null, bool $getShared = tr return static::getSharedInstance('format', $config); } - $config ??= config('Format'); + $config ??= config(FormatConfig::class); return new Format($config); } @@ -315,7 +319,7 @@ public static function honeypot(?HoneypotConfig $config = null, bool $getShared return static::getSharedInstance('honeypot', $config); } - $config ??= config('Honeypot'); + $config ??= config(HoneypotConfig::class); return new Honeypot($config); } @@ -332,7 +336,7 @@ public static function image(?string $handler = null, ?Images $config = null, bo return static::getSharedInstance('image', $handler, $config); } - $config ??= config('Images'); + $config ??= config(Images::class); assert($config instanceof Images); $handler = $handler ?: $config->defaultHandler; @@ -392,7 +396,7 @@ public static function logger(bool $getShared = true) return static::getSharedInstance('logger'); } - return new Logger(config('Logger')); + return new Logger(config(LoggerConfig::class)); } /** @@ -406,7 +410,7 @@ public static function migrations(?Migrations $config = null, ?ConnectionInterfa return static::getSharedInstance('migrations', $config, $db); } - $config ??= config('Migrations'); + $config ??= config(Migrations::class); return new MigrationRunner($config, $db); } @@ -440,7 +444,7 @@ public static function pager(?PagerConfig $config = null, ?RendererInterface $vi return static::getSharedInstance('pager', $config, $view); } - $config ??= config('Pager'); + $config ??= config(PagerConfig::class); $view ??= AppServices::renderer(); return new Pager($config, $view); @@ -457,8 +461,8 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu return static::getSharedInstance('parser', $viewPath, $config); } - $viewPath = $viewPath ?: config('Paths')->viewDirectory; - $config ??= config('View'); + $viewPath = $viewPath ?: config(Paths::class)->viewDirectory; + $config ??= config(ViewConfig::class); return new Parser($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger()); } @@ -476,8 +480,8 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config = return static::getSharedInstance('renderer', $viewPath, $config); } - $viewPath = $viewPath ?: config('Paths')->viewDirectory; - $config ??= config('View'); + $viewPath = $viewPath ?: config(Paths::class)->viewDirectory; + $config ??= config(ViewConfig::class); return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger()); } @@ -536,7 +540,7 @@ public static function incomingrequest(?App $config = null, bool $getShared = tr return static::getSharedInstance('request', $config); } - $config ??= config('App'); + $config ??= config(App::class); return new IncomingRequest( $config, @@ -557,7 +561,7 @@ public static function response(?App $config = null, bool $getShared = true) return static::getSharedInstance('response', $config); } - $config ??= config('App'); + $config ??= config(App::class); return new Response($config); } @@ -573,7 +577,7 @@ public static function redirectresponse(?App $config = null, bool $getShared = t return static::getSharedInstance('redirectresponse', $config); } - $config ??= config('App'); + $config ??= config(App::class); $response = new RedirectResponse($config); $response->setProtocolVersion(AppServices::request()->getProtocolVersion()); @@ -592,7 +596,7 @@ public static function routes(bool $getShared = true) return static::getSharedInstance('routes'); } - return new RouteCollection(AppServices::locator(), config('Modules')); + return new RouteCollection(AppServices::locator(), config(Modules::class)); } /** @@ -625,7 +629,7 @@ public static function security(?App $config = null, bool $getShared = true) return static::getSharedInstance('security', $config); } - $config ??= config('App'); + $config ??= config(App::class); return new Security($config); } @@ -641,13 +645,13 @@ public static function session(?App $config = null, bool $getShared = true) return static::getSharedInstance('session', $config); } - $config ??= config('App'); + $config ??= config(App::class); assert($config instanceof App); $logger = AppServices::logger(); /** @var SessionConfig|null $sessionConfig */ - $sessionConfig = config('Session'); + $sessionConfig = config(SessionConfig::class); $driverName = $sessionConfig->driver ?? $config->sessionDriver; @@ -718,7 +722,7 @@ public static function toolbar(?ToolbarConfig $config = null, bool $getShared = return static::getSharedInstance('toolbar', $config); } - $config ??= config('Toolbar'); + $config ??= config(ToolbarConfig::class); return new Toolbar($config); } @@ -750,7 +754,7 @@ public static function validation(?ValidationConfig $config = null, bool $getSha return static::getSharedInstance('validation', $config); } - $config ??= config('Validation'); + $config ??= config(ValidationConfig::class); return new Validation($config, AppServices::renderer()); } diff --git a/system/Controller.php b/system/Controller.php index 870f15b4fc04..64de91ab2938 100644 --- a/system/Controller.php +++ b/system/Controller.php @@ -17,6 +17,7 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use CodeIgniter\Validation\ValidationInterface; use Config\Services; +use Config\Validation; use Psr\Log\LoggerInterface; /** @@ -164,7 +165,7 @@ private function setValidator($rules, array $messages): void // If you replace the $rules array with the name of the group if (is_string($rules)) { - $validation = config('Validation'); + $validation = config(Validation::class); // If the rule wasn't found in the \Config\Validation, we // should throw an exception so the developer can find it. diff --git a/system/Database/Config.php b/system/Database/Config.php index 802a4da25ac6..f34d0395bc69 100644 --- a/system/Database/Config.php +++ b/system/Database/Config.php @@ -57,8 +57,7 @@ public static function connect($group = null, bool $getShared = true) $config = $group; $group = 'custom-' . md5(json_encode($config)); } else { - /** @var DbConfig $dbConfig */ - $dbConfig = config('Database'); + $dbConfig = config(DbConfig::class); if ($group === null) { $group = (ENVIRONMENT === 'testing') ? 'tests' : $dbConfig->defaultGroup; @@ -132,7 +131,7 @@ public static function utils($group = null) */ public static function seeder(?string $group = null) { - $config = config('Database'); + $config = config(DbConfig::class); return new Seeder($config, static::connect($group)); } diff --git a/system/Database/Migration.php b/system/Database/Migration.php index 6b1cf82d642d..0f1ab2c74f2f 100644 --- a/system/Database/Migration.php +++ b/system/Database/Migration.php @@ -46,7 +46,7 @@ abstract class Migration */ public function __construct(?Forge $forge = null) { - $this->forge = $forge ?? Database::forge($this->DBGroup ?? config('Database')->defaultGroup); + $this->forge = $forge ?? Database::forge($this->DBGroup ?? config(Database::class)->defaultGroup); $this->db = $this->forge->getConnection(); } diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 569be22807e0..eda6bb582e80 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -142,7 +142,7 @@ public function __construct(MigrationsConfig $config, $db = null) $this->namespace = APP_NAMESPACE; // get default database group - $config = config('Database'); + $config = config(Database::class); $this->group = $config->defaultGroup; unset($config); @@ -844,7 +844,7 @@ protected function migrate($direction, $migration): bool } $instance = new $class(); - $group = $instance->getDBGroup() ?? config('Database')->defaultGroup; + $group = $instance->getDBGroup() ?? config(Database::class)->defaultGroup; if (ENVIRONMENT !== 'testing' && $group === 'tests' && $this->groupFilter !== 'tests') { // @codeCoverageIgnoreStart diff --git a/system/Debug/Toolbar/Collectors/Config.php b/system/Debug/Toolbar/Collectors/Config.php index b4600555442d..faf7a19b7391 100644 --- a/system/Debug/Toolbar/Collectors/Config.php +++ b/system/Debug/Toolbar/Collectors/Config.php @@ -12,6 +12,7 @@ namespace CodeIgniter\Debug\Toolbar\Collectors; use CodeIgniter\CodeIgniter; +use Config\App; use Config\Services; /** @@ -24,7 +25,7 @@ class Config */ public static function display(): array { - $config = config('App'); + $config = config(App::class); return [ 'ciVersion' => CodeIgniter::CI_VERSION, diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index c7ed6703b402..9d4099f46691 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -13,6 +13,7 @@ use CodeIgniter\Database\Query; use CodeIgniter\I18n\Time; +use Config\Toolbar; /** * Collector for the Database tab of the Debug Toolbar. @@ -78,7 +79,7 @@ public function __construct() */ public static function collect(Query $query) { - $config = config('Toolbar'); + $config = config(Toolbar::class); // Provide default in case it's not set $max = $config->maxQueries ?: 100; diff --git a/system/Encryption/Handlers/BaseHandler.php b/system/Encryption/Handlers/BaseHandler.php index 894cb81d30cf..08c0234a5d6d 100644 --- a/system/Encryption/Handlers/BaseHandler.php +++ b/system/Encryption/Handlers/BaseHandler.php @@ -24,7 +24,7 @@ abstract class BaseHandler implements EncrypterInterface */ public function __construct(?Encryption $config = null) { - $config ??= config('Encryption'); + $config ??= config(Encryption::class); // make the parameters conveniently accessible foreach (get_object_vars($config) as $key => $value) { diff --git a/system/Events/Events.php b/system/Events/Events.php index 064f01ab4104..f90af36c2e57 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -71,8 +71,7 @@ public static function initialize() return; } - /** @var Modules $config */ - $config = config('Modules'); + $config = config(Modules::class); $events = APPPATH . 'Config' . DIRECTORY_SEPARATOR . 'Events.php'; $files = []; diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index c022d7d7fda1..784c45c48be6 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -106,7 +106,7 @@ public function __construct($config, RequestInterface $request, ResponseInterfac $this->request = &$request; $this->setResponse($response); - $this->modules = $modules ?? config('Modules'); + $this->modules = $modules ?? config(Modules::class); if ($this->modules->shouldDiscover('filters')) { $this->discoverFilters(); diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 1f467a57521f..377f51e46006 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -112,12 +112,12 @@ public function __construct(App $config, URI $uri, ?ResponseInterface $response parent::__construct('GET', $uri); - $this->responseOrig = $response ?? new Response(config('App')); + $this->responseOrig = $response ?? new Response(config(App::class)); $this->baseURI = $uri->useRawQueryString(); $this->defaultOptions = $options; /** @var ConfigCURLRequest|null $configCURLRequest */ - $configCURLRequest = config('CURLRequest'); + $configCURLRequest = config(ConfigCURLRequest::class); $this->shareOptions = $configCURLRequest->shareOptions ?? true; $this->config = $this->defaultConfig; diff --git a/system/HTTP/ContentSecurityPolicy.php b/system/HTTP/ContentSecurityPolicy.php index 3cc9b03a58db..2ff9e355a83e 100644 --- a/system/HTTP/ContentSecurityPolicy.php +++ b/system/HTTP/ContentSecurityPolicy.php @@ -11,6 +11,7 @@ namespace CodeIgniter\HTTP; +use Config\App; use Config\ContentSecurityPolicy as ContentSecurityPolicyConfig; /** @@ -241,7 +242,7 @@ class ContentSecurityPolicy */ public function __construct(ContentSecurityPolicyConfig $config) { - $appConfig = config('App'); + $appConfig = config(App::class); $this->CSPEnabled = $appConfig->CSPEnabled; foreach (get_object_vars($config) as $setting => $value) { diff --git a/system/HTTP/DownloadResponse.php b/system/HTTP/DownloadResponse.php index d5824da1cabc..d8fb8c035a03 100644 --- a/system/HTTP/DownloadResponse.php +++ b/system/HTTP/DownloadResponse.php @@ -13,6 +13,7 @@ use CodeIgniter\Exceptions\DownloadException; use CodeIgniter\Files\File; +use Config\App; use Config\Mimes; /** @@ -64,7 +65,7 @@ class DownloadResponse extends Response */ public function __construct(string $filename, bool $setMime) { - parent::__construct(config('App')); + parent::__construct(config(App::class)); $this->filename = $filename; $this->setMime = $setMime; diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 418da59865b2..7c703c3a9c47 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -13,6 +13,7 @@ use CodeIgniter\Exceptions\ConfigException; use CodeIgniter\Validation\FormatRules; +use Config\App; /** * Request Trait @@ -63,7 +64,7 @@ public function getIPAddress(): string * @deprecated $this->proxyIPs property will be removed in the future */ // @phpstan-ignore-next-line - $proxyIPs = $this->proxyIPs ?? config('App')->proxyIPs; + $proxyIPs = $this->proxyIPs ?? config(App::class)->proxyIPs; // @phpstan-ignore-next-line if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) { throw new ConfigException( diff --git a/system/HTTP/Response.php b/system/HTTP/Response.php index 21db9acd4191..f573905d1edd 100644 --- a/system/HTTP/Response.php +++ b/system/HTTP/Response.php @@ -16,6 +16,7 @@ use CodeIgniter\Cookie\Exceptions\CookieException; use CodeIgniter\HTTP\Exceptions\HTTPException; use Config\App; +use Config\Cookie as CookieConfig; use Config\Services; /** @@ -172,7 +173,7 @@ public function __construct($config) } $this->cookieStore = new CookieStore([]); - Cookie::setDefaults(config('Cookie') ?? [ + Cookie::setDefaults(config(CookieConfig::class) ?? [ // @todo Remove this fallback when deprecated `App` members are removed 'prefix' => $config->cookiePrefix, 'path' => $config->cookiePath, diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 133d1b193b3b..361c73006526 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -582,7 +582,7 @@ public function setCookie( } /** @var CookieConfig|null $cookieConfig */ - $cookieConfig = config('Cookie'); + $cookieConfig = config(CookieConfig::class); if ($cookieConfig instanceof CookieConfig) { $secure ??= $cookieConfig->secure; diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index 587e441ffc17..dee9365ded51 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -13,6 +13,7 @@ use BadMethodCallException; use CodeIgniter\HTTP\Exceptions\HTTPException; +use Config\App; /** * Abstraction for a uniform resource identifier (URI). @@ -622,7 +623,7 @@ public function __toString(): string private function changeSchemeAndPath(string $scheme, string $path): array { // Check if this is an internal URI - $config = config('App'); + $config = config(App::class); $baseUri = new self($config->baseURL); if ( diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index 0a11ce84b76d..cb5f227279d3 100755 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -69,10 +69,10 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '') { if ($prefix === '') { /** @var Cookie|null $cookie */ - $cookie = config('Cookie'); + $cookie = config(Cookie::class); // @TODO Remove Config\App fallback when deprecated `App` members are removed. - $prefix = $cookie instanceof Cookie ? $cookie->prefix : config('App')->cookiePrefix; + $prefix = $cookie instanceof Cookie ? $cookie->prefix : config(App::class)->cookiePrefix; } $request = Services::request(); diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index dfd4a64f0669..c553bddee2c3 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -10,7 +10,9 @@ */ use CodeIgniter\Validation\Exceptions\ValidationException; +use Config\App; use Config\Services; +use Config\Validation; // CodeIgniter Form Helpers @@ -50,7 +52,7 @@ function form_open(string $action = '', $attributes = [], array $hidden = []): s $attributes .= ' method="post"'; } if (stripos($attributes, 'accept-charset=') === false) { - $config = config('App'); + $config = config(App::class); $attributes .= ' accept-charset="' . strtolower($config->charset) . '"'; } @@ -718,7 +720,7 @@ function validation_errors() */ function validation_list_errors(string $template = 'list'): string { - $config = config('Validation'); + $config = config(Validation::class); $view = Services::renderer(); if (! array_key_exists($template, $config->templates)) { @@ -738,7 +740,7 @@ function validation_list_errors(string $template = 'list'): string */ function validation_show_error(string $field, string $template = 'single'): string { - $config = config('Validation'); + $config = config(Validation::class); $view = Services::renderer(); $errors = array_filter(validation_errors(), static fn ($key) => preg_match( diff --git a/system/Helpers/url_helper.php b/system/Helpers/url_helper.php index 8443c7a02980..c6c810b66da6 100644 --- a/system/Helpers/url_helper.php +++ b/system/Helpers/url_helper.php @@ -38,7 +38,7 @@ function _get_uri($relativePath = '', ?App $config = null): URI $appConfig = null; if ($config === null) { /** @var App $appConfig */ - $appConfig = config('App'); + $appConfig = config(App::class); if ($appConfig->baseURL === '') { throw new InvalidArgumentException( @@ -145,7 +145,7 @@ function site_url($relativePath = '', ?string $scheme = null, ?App $config = nul function base_url($relativePath = '', ?string $scheme = null): string { /** @var App $config */ - $config = clone config('App'); + $config = clone config(App::class); // Use the current baseURL for multiple domain support $request = Services::request(); @@ -238,7 +238,7 @@ function uri_string(): string function index_page(?App $altConfig = null): string { // use alternate config if provided, else default one - $config = $altConfig ?? config('App'); + $config = $altConfig ?? config(App::class); return $config->indexPage; } @@ -258,7 +258,7 @@ function index_page(?App $altConfig = null): string function anchor($uri = '', string $title = '', $attributes = '', ?App $altConfig = null): string { // use alternate config if provided, else default one - $config = $altConfig ?? config('App'); + $config = $altConfig ?? config(App::class); $siteUrl = is_array($uri) ? site_url($uri, null, $config) : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri, null, $config)); // eliminate trailing slash @@ -291,7 +291,7 @@ function anchor($uri = '', string $title = '', $attributes = '', ?App $altConfig function anchor_popup($uri = '', string $title = '', $attributes = false, ?App $altConfig = null): string { // use alternate config if provided, else default one - $config = $altConfig ?? config('App'); + $config = $altConfig ?? config(App::class); $siteUrl = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri, null, $config); $siteUrl = rtrim($siteUrl, '/'); diff --git a/system/Publisher/Publisher.php b/system/Publisher/Publisher.php index 88459153188f..82948b8378c1 100644 --- a/system/Publisher/Publisher.php +++ b/system/Publisher/Publisher.php @@ -15,6 +15,7 @@ use CodeIgniter\Files\FileCollection; use CodeIgniter\HTTP\URI; use CodeIgniter\Publisher\Exceptions\PublisherException; +use Config\Publisher as PublisherConfig; use RuntimeException; use Throwable; @@ -162,7 +163,7 @@ public function __construct(?string $source = null, ?string $destination = null) $this->replacer = new ContentReplacer(); // Restrictions are intentionally not injected to prevent overriding - $this->restrictions = config('Publisher')->restrictions; + $this->restrictions = config(PublisherConfig::class)->restrictions; // Make sure the destination is allowed foreach (array_keys($this->restrictions) as $directory) { diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 66724935e31c..965a0c746ce7 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1265,8 +1265,7 @@ private function replaceLocale(string $route, ?string $locale = null): string // Check invalid locale if ($locale !== null) { - /** @var App $config */ - $config = config('App'); + $config = config(App::class); if (! in_array($locale, $config->supportedLocales, true)) { $locale = null; } diff --git a/system/Router/Router.php b/system/Router/Router.php index f9299fa1dd0a..be698003cbe5 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -16,6 +16,8 @@ use CodeIgniter\HTTP\Request; use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\Exceptions\RouterException; +use Config\App; +use Config\Feature; /** * Request router. @@ -131,7 +133,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request $this->translateURIDashes = $this->collection->shouldTranslateURIDashes(); if ($this->collection->shouldAutoRoute()) { - $autoRoutesImproved = config('Feature')->autoRoutesImproved ?? false; + $autoRoutesImproved = config(Feature::class)->autoRoutesImproved ?? false; if ($autoRoutesImproved) { $this->autoRouter = new AutoRouterImproved( $this->collection->getRegisteredControllers('*'), @@ -181,7 +183,7 @@ public function handle(?string $uri = null) // Checks defined routes if ($this->checkRoutes($uri)) { if ($this->collection->isFiltered($this->matchedRoute[0])) { - $multipleFiltersEnabled = config('Feature')->multipleFilters ?? false; + $multipleFiltersEnabled = config(Feature::class)->multipleFilters ?? false; if ($multipleFiltersEnabled) { $this->filtersInfo = $this->collection->getFiltersForRoute($this->matchedRoute[0]); } else { @@ -441,7 +443,7 @@ protected function checkRoutes(string $uri): bool ); if ($this->collection->shouldUseSupportedLocalesOnly() - && ! in_array($matched['locale'], config('App')->supportedLocales, true)) { + && ! in_array($matched['locale'], config(App::class)->supportedLocales, true)) { // Throw exception to prevent the autorouter, if enabled, // from trying to find a route throw PageNotFoundException::forLocaleNotSupported($matched['locale']); diff --git a/system/Security/Security.php b/system/Security/Security.php index 239156719260..c31cea42288f 100644 --- a/system/Security/Security.php +++ b/system/Security/Security.php @@ -172,7 +172,7 @@ class Security implements SecurityInterface public function __construct(App $config) { /** @var SecurityConfig|null $security */ - $security = config('Security'); + $security = config(SecurityConfig::class); // Store CSRF-related configurations if ($security instanceof SecurityConfig) { @@ -223,7 +223,7 @@ private function configureSession(): void private function configureCookie(App $config): void { /** @var CookieConfig|null $cookie */ - $cookie = config('Cookie'); + $cookie = config(CookieConfig::class); if ($cookie instanceof CookieConfig) { $cookiePrefix = $cookie->prefix; diff --git a/system/Session/Handlers/BaseHandler.php b/system/Session/Handlers/BaseHandler.php index f392c492cf76..9ea9df971d1e 100644 --- a/system/Session/Handlers/BaseHandler.php +++ b/system/Session/Handlers/BaseHandler.php @@ -108,7 +108,7 @@ abstract class BaseHandler implements SessionHandlerInterface public function __construct(AppConfig $config, string $ipAddress) { /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); // Store Session configurations if ($session instanceof SessionConfig) { @@ -123,7 +123,7 @@ public function __construct(AppConfig $config, string $ipAddress) } /** @var CookieConfig|null $cookie */ - $cookie = config('Cookie'); + $cookie = config(CookieConfig::class); if ($cookie instanceof CookieConfig) { // Session cookies have no prefix. diff --git a/system/Session/Handlers/DatabaseHandler.php b/system/Session/Handlers/DatabaseHandler.php index b566a3b04d9e..fa474faae54a 100644 --- a/system/Session/Handlers/DatabaseHandler.php +++ b/system/Session/Handlers/DatabaseHandler.php @@ -74,7 +74,7 @@ public function __construct(AppConfig $config, string $ipAddress) parent::__construct($config, $ipAddress); /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); // Store Session configurations if ($session instanceof SessionConfig) { diff --git a/system/Session/Handlers/MemcachedHandler.php b/system/Session/Handlers/MemcachedHandler.php index e4c8c6e8c673..e6f575e94b84 100644 --- a/system/Session/Handlers/MemcachedHandler.php +++ b/system/Session/Handlers/MemcachedHandler.php @@ -59,7 +59,7 @@ public function __construct(AppConfig $config, string $ipAddress) parent::__construct($config, $ipAddress); /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); $this->sessionExpiration = ($session instanceof SessionConfig) ? $session->expiration : $config->sessionExpiration; diff --git a/system/Session/Handlers/RedisHandler.php b/system/Session/Handlers/RedisHandler.php index 9910637663f5..56b725327dd7 100644 --- a/system/Session/Handlers/RedisHandler.php +++ b/system/Session/Handlers/RedisHandler.php @@ -72,7 +72,7 @@ public function __construct(AppConfig $config, string $ipAddress) parent::__construct($config, $ipAddress); /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); // Store Session configurations if ($session instanceof SessionConfig) { diff --git a/system/Session/Session.php b/system/Session/Session.php index 4f536ca0b0f0..efbd67d513ee 100644 --- a/system/Session/Session.php +++ b/system/Session/Session.php @@ -166,7 +166,7 @@ public function __construct(SessionHandlerInterface $driver, App $config) $this->driver = $driver; /** @var SessionConfig|null $session */ - $session = config('Session'); + $session = config(SessionConfig::class); // Store Session configurations if ($session instanceof SessionConfig) { @@ -195,7 +195,7 @@ public function __construct(SessionHandlerInterface $driver, App $config) $this->cookieSameSite = $config->cookieSameSite ?? $this->cookieSameSite; /** @var CookieConfig $cookie */ - $cookie = config('Cookie'); + $cookie = config(CookieConfig::class); $this->cookie = (new Cookie($this->sessionCookieName, '', [ 'expires' => $this->sessionExpiration === 0 ? 0 : Time::now()->getTimestamp() + $this->sessionExpiration, diff --git a/system/Test/CIUnitTestCase.php b/system/Test/CIUnitTestCase.php index bfde56faf6ff..0ed50a500c55 100644 --- a/system/Test/CIUnitTestCase.php +++ b/system/Test/CIUnitTestCase.php @@ -25,6 +25,7 @@ use CodeIgniter\Test\Mock\MockSession; use Config\App; use Config\Autoload; +use Config\Email; use Config\Modules; use Config\Services; use Exception; @@ -323,7 +324,7 @@ protected function mockCache() */ protected function mockEmail() { - Services::injectMock('email', new MockEmail(config('Email'))); + Services::injectMock('email', new MockEmail(config(Email::class))); } /** @@ -333,7 +334,7 @@ protected function mockSession() { $_SESSION = []; - $config = config('App'); + $config = config(App::class); $session = new MockSession(new ArrayHandler($config, '0.0.0.0'), $config); Services::injectMock('session', $session); diff --git a/system/Test/ControllerTestTrait.php b/system/Test/ControllerTestTrait.php index 64cbcbe175c0..828dabb9e946 100644 --- a/system/Test/ControllerTestTrait.php +++ b/system/Test/ControllerTestTrait.php @@ -96,7 +96,7 @@ protected function setUpControllerTestTrait(): void helper('url'); if (empty($this->appConfig)) { - $this->appConfig = config('App'); + $this->appConfig = config(App::class); } if (! $this->uri instanceof URI) { diff --git a/system/Test/ControllerTester.php b/system/Test/ControllerTester.php index a4b41a94c308..2fff82eeceb1 100644 --- a/system/Test/ControllerTester.php +++ b/system/Test/ControllerTester.php @@ -96,7 +96,7 @@ trait ControllerTester protected function setUpControllerTester(): void { if (empty($this->appConfig)) { - $this->appConfig = config('App'); + $this->appConfig = config(App::class); } if (! $this->uri instanceof URI) { diff --git a/system/Test/Fabricator.php b/system/Test/Fabricator.php index df1906b6416c..6c9e82ff5c00 100644 --- a/system/Test/Fabricator.php +++ b/system/Test/Fabricator.php @@ -14,6 +14,7 @@ use CodeIgniter\Exceptions\FrameworkException; use CodeIgniter\I18n\Time; use CodeIgniter\Model; +use Config\App; use Faker\Factory; use Faker\Generator; use InvalidArgumentException; @@ -114,7 +115,7 @@ public function __construct($model, ?array $formatters = null, ?string $locale = // If no locale was specified then use the App default if ($locale === null) { - $locale = config('App')->defaultLocale; + $locale = config(App::class)->defaultLocale; } // There is no easy way to retrieve the locale from Faker so we will store it diff --git a/system/Test/FeatureTestCase.php b/system/Test/FeatureTestCase.php index bf157aea52af..0bef873297e4 100644 --- a/system/Test/FeatureTestCase.php +++ b/system/Test/FeatureTestCase.php @@ -18,6 +18,7 @@ use CodeIgniter\HTTP\UserAgent; use CodeIgniter\Router\Exceptions\RedirectException; use CodeIgniter\Router\RouteCollection; +use Config\App; use Config\Services; use Exception; use ReflectionException; @@ -291,7 +292,7 @@ public function options(string $path, ?array $params = null) */ protected function setupRequest(string $method, ?string $path = null): IncomingRequest { - $config = config('App'); + $config = config(App::class); $uri = new URI(rtrim($config->baseURL, '/') . '/' . trim($path, '/ ')); $request = new IncomingRequest($config, clone $uri, null, new UserAgent()); diff --git a/system/Test/FilterTestTrait.php b/system/Test/FilterTestTrait.php index 3bcd37962941..4901a585ce20 100644 --- a/system/Test/FilterTestTrait.php +++ b/system/Test/FilterTestTrait.php @@ -98,7 +98,7 @@ protected function setUpFilterTestTrait(): void $this->response ??= clone Services::response(); // Create our config and Filters instance to reuse for performance - $this->filtersConfig ??= config('Filters'); + $this->filtersConfig ??= config(FiltersConfig::class); $this->filters ??= new Filters($this->filtersConfig, $this->request, $this->response); if ($this->collection === null) { diff --git a/system/Typography/Typography.php b/system/Typography/Typography.php index 9b72c64c1ac9..1ca7a56ff598 100644 --- a/system/Typography/Typography.php +++ b/system/Typography/Typography.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Typography; +use Config\DocTypes; + /** * Typography Class */ @@ -324,7 +326,7 @@ public function nl2brExceptPre(string $str): string $newstr = ''; for ($ex = explode('pre>', $str), $ct = count($ex), $i = 0; $i < $ct; $i++) { - $xhtml = ! (config('DocTypes')->html5 ?? false); + $xhtml = ! (config(DocTypes::class)->html5 ?? false); $newstr .= (($i % 2) === 0) ? nl2br($ex[$i], $xhtml) : $ex[$i]; if ($ct - 1 !== $i) { diff --git a/system/View/ViewDecoratorTrait.php b/system/View/ViewDecoratorTrait.php index 243c229bfbde..97cdbe0a252d 100644 --- a/system/View/ViewDecoratorTrait.php +++ b/system/View/ViewDecoratorTrait.php @@ -12,6 +12,7 @@ namespace CodeIgniter\View; use CodeIgniter\View\Exceptions\ViewException; +use Config\View as ViewConfig; trait ViewDecoratorTrait { @@ -21,7 +22,7 @@ trait ViewDecoratorTrait */ protected function decorateOutput(string $html): string { - $decorators = \config('View')->decorators; + $decorators = \config(ViewConfig::class)->decorators; foreach ($decorators as $decorator) { if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) { From f92f091694dfa27280c4bf8c9532bada90bc7b0b Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Sat, 24 Jun 2023 21:54:17 +0900 Subject: [PATCH 041/237] docs: Replace type `mixed` in system. --- system/BaseModel.php | 2 +- system/CodeIgniter.php | 2 +- system/Common.php | 8 ++++---- system/Model.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/system/BaseModel.php b/system/BaseModel.php index 26b6952291e4..8d5b4276eb43 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -1711,7 +1711,7 @@ protected function transformDataToArray($data, string $type): array * * @param string $name Name * - * @return mixed + * @return array|bool|int|object|string|null */ public function __get(string $name) { diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 829b65ea952b..5285a9293ae1 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -732,7 +732,7 @@ public static function cache(int $time) * Caches the full response from the current request. Used for * full-page caching for very high performance. * - * @return mixed + * @return bool */ public function cachePage(Cache $config) { diff --git a/system/Common.php b/system/Common.php index 8d366973f14d..bdc937af2aa7 100644 --- a/system/Common.php +++ b/system/Common.php @@ -65,8 +65,8 @@ function app_timezone(): string * cache()->save('foo', 'bar'); * $foo = cache('bar'); * - * @return CacheInterface|mixed - * @phpstan-return ($key is null ? CacheInterface : mixed) + * @return array|bool|CacheInterface|float|int|object|string|null + * @phpstan-return ($key is null ? CacheInterface : array|bool|float|int|object|string|null) */ function cache(?string $key = null) { @@ -1003,7 +1003,7 @@ function session(?string $val = null) * - $timer = service('timer') * - $timer = \CodeIgniter\Config\Services::timer(); * - * @param mixed ...$params + * @param array|bool|float|int|object|string|null ...$params * * @return object */ @@ -1017,7 +1017,7 @@ function service(string $name, ...$params) /** * Always returns a new instance of the class. * - * @param mixed ...$params + * @param array|bool|float|int|object|string|null ...$params * * @return object|null */ diff --git a/system/Model.php b/system/Model.php index 80e4bb48a34c..c28bf2b9da1c 100644 --- a/system/Model.php +++ b/system/Model.php @@ -792,7 +792,7 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur * * @param string $name Name * - * @return mixed + * @return array|BaseBuilder|bool|int|object|string|null */ public function __get(string $name) { @@ -821,7 +821,7 @@ public function __isset(string $name): bool * Provides direct access to method in the builder (if available) * and the database connection. * - * @return mixed + * @return array|BaseBuilder|bool|float|int|object|string|null */ public function __call(string $name, array $params) { From ec5cb2fcb9d2790ec7000c2dc4967db7b2925175 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 26 Jun 2023 15:05:54 +0900 Subject: [PATCH 042/237] refactor: add workaround for old Config\App file --- system/HTTP/RequestTrait.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 7c703c3a9c47..3bbcf936a91f 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -66,6 +66,11 @@ public function getIPAddress(): string // @phpstan-ignore-next-line $proxyIPs = $this->proxyIPs ?? config(App::class)->proxyIPs; // @phpstan-ignore-next-line + + // Workaround for old Config\App file. App::$proxyIPs may be empty string. + if ($proxyIPs === '') { + $proxyIPs = []; + } if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) { throw new ConfigException( 'You must set an array with Proxy IP address key and HTTP header name value in Config\App::$proxyIPs.' From b819f9d4e76643ea5e08a96376b1c36e14eb166e Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 26 Jun 2023 15:10:00 +0900 Subject: [PATCH 043/237] refactor: by RemoveUnusedNonEmptyArrayBeforeForeachRector --- system/HTTP/RequestTrait.php | 106 +++++++++++++++++------------------ 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index 3bbcf936a91f..57f97982dea4 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -84,76 +84,74 @@ public function getIPAddress(): string return $this->ipAddress = '0.0.0.0'; } - if ($proxyIPs) { - // @TODO Extract all this IP address logic to another class. - foreach ($proxyIPs as $proxyIP => $header) { - // Check if we have an IP address or a subnet - if (strpos($proxyIP, '/') === false) { - // An IP address (and not a subnet) is specified. - // We can compare right away. - if ($proxyIP === $this->ipAddress) { - $spoof = $this->getClientIP($header); - - if ($spoof !== null) { - $this->ipAddress = $spoof; - break; - } - } + // @TODO Extract all this IP address logic to another class. + foreach ($proxyIPs as $proxyIP => $header) { + // Check if we have an IP address or a subnet + if (strpos($proxyIP, '/') === false) { + // An IP address (and not a subnet) is specified. + // We can compare right away. + if ($proxyIP === $this->ipAddress) { + $spoof = $this->getClientIP($header); - continue; + if ($spoof !== null) { + $this->ipAddress = $spoof; + break; + } } - // We have a subnet ... now the heavy lifting begins - if (! isset($separator)) { - $separator = $ipValidator($this->ipAddress, 'ipv6') ? ':' : '.'; - } + continue; + } - // If the proxy entry doesn't match the IP protocol - skip it - if (strpos($proxyIP, $separator) === false) { - continue; - } + // We have a subnet ... now the heavy lifting begins + if (! isset($separator)) { + $separator = $ipValidator($this->ipAddress, 'ipv6') ? ':' : '.'; + } - // Convert the REMOTE_ADDR IP address to binary, if needed - if (! isset($ip, $sprintf)) { - if ($separator === ':') { - // Make sure we're having the "full" IPv6 format - $ip = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($this->ipAddress, ':')), $this->ipAddress)); + // If the proxy entry doesn't match the IP protocol - skip it + if (strpos($proxyIP, $separator) === false) { + continue; + } - for ($j = 0; $j < 8; $j++) { - $ip[$j] = intval($ip[$j], 16); - } + // Convert the REMOTE_ADDR IP address to binary, if needed + if (! isset($ip, $sprintf)) { + if ($separator === ':') { + // Make sure we're having the "full" IPv6 format + $ip = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($this->ipAddress, ':')), $this->ipAddress)); - $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b'; - } else { - $ip = explode('.', $this->ipAddress); - $sprintf = '%08b%08b%08b%08b'; + for ($j = 0; $j < 8; $j++) { + $ip[$j] = intval($ip[$j], 16); } - $ip = vsprintf($sprintf, $ip); + $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b'; + } else { + $ip = explode('.', $this->ipAddress); + $sprintf = '%08b%08b%08b%08b'; } - // Split the netmask length off the network address - sscanf($proxyIP, '%[^/]/%d', $netaddr, $masklen); + $ip = vsprintf($sprintf, $ip); + } - // Again, an IPv6 address is most likely in a compressed form - if ($separator === ':') { - $netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr)); + // Split the netmask length off the network address + sscanf($proxyIP, '%[^/]/%d', $netaddr, $masklen); - for ($i = 0; $i < 8; $i++) { - $netaddr[$i] = intval($netaddr[$i], 16); - } - } else { - $netaddr = explode('.', $netaddr); + // Again, an IPv6 address is most likely in a compressed form + if ($separator === ':') { + $netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr)); + + for ($i = 0; $i < 8; $i++) { + $netaddr[$i] = intval($netaddr[$i], 16); } + } else { + $netaddr = explode('.', $netaddr); + } - // Convert to binary and finally compare - if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0) { - $spoof = $this->getClientIP($header); + // Convert to binary and finally compare + if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0) { + $spoof = $this->getClientIP($header); - if ($spoof !== null) { - $this->ipAddress = $spoof; - break; - } + if ($spoof !== null) { + $this->ipAddress = $spoof; + break; } } } From 1db90c402bded14b1ff5f269cde7275e9eb1e5d0 Mon Sep 17 00:00:00 2001 From: Jozef Rebjak Date: Mon, 26 Jun 2023 13:07:39 +0200 Subject: [PATCH 044/237] fix: skip http proxy added header --- system/HTTP/CURLRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 377f51e46006..616ef143fde8 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -387,6 +387,10 @@ public function send(string $method, string $url) $output = substr($output, strpos($output, $breakString) + 4); } + if (strpos($output, 'HTTP/1.1 200 Connection established') === 0) { + $output = substr($output, strpos($output, $breakString) + 4); + } + // If request and response have Digest if (isset($this->config['auth'][2]) && $this->config['auth'][2] === 'digest' && strpos($output, 'WWW-Authenticate: Digest') !== false) { $output = substr($output, strpos($output, $breakString) + 4); From 9a41f6b18c6e6e6ff8cdb34f4e82e11481d5ec9b Mon Sep 17 00:00:00 2001 From: Jozef Rebjak Date: Mon, 26 Jun 2023 13:52:36 +0200 Subject: [PATCH 045/237] test: add testSendProxied --- tests/system/HTTP/CURLRequestTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 92c43cc58461..41ebee307374 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -718,6 +718,18 @@ public function testSendContinued() $this->assertSame('Hi there', $response->getBody()); } + public function testSendProxied() + { + $request = $this->getRequest([ + 'base_uri' => 'http://www.foo.com/api/v1/', + 'delay' => 100, + ]); + + $request->setOutput("HTTP/1.1 200 Connection established:\x0d\x0a\x0d\x0aHi there"); + $response = $request->get('answer'); + $this->assertSame('Hi there', $response->getBody()); + } + /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/3261 */ From 8d023d9255822e05c2b4622125518eec7348ce59 Mon Sep 17 00:00:00 2001 From: Jozef Rebjak Date: Mon, 26 Jun 2023 13:55:32 +0200 Subject: [PATCH 046/237] fix: testSendProxied typo --- tests/system/HTTP/CURLRequestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 41ebee307374..d1ae4ea5db06 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -725,7 +725,7 @@ public function testSendProxied() 'delay' => 100, ]); - $request->setOutput("HTTP/1.1 200 Connection established:\x0d\x0a\x0d\x0aHi there"); + $request->setOutput("HTTP/1.1 200 Connection established\x0d\x0a\x0d\x0aHi there"); $response = $request->get('answer'); $this->assertSame('Hi there', $response->getBody()); } From a20365b9c9877a4f6cc050403889439a69099371 Mon Sep 17 00:00:00 2001 From: Jozef Rebjak Date: Mon, 26 Jun 2023 14:02:04 +0200 Subject: [PATCH 047/237] test: improve testSendProxied --- tests/system/HTTP/CURLRequestTest.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index d1ae4ea5db06..d90b8847cbb6 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -718,18 +718,6 @@ public function testSendContinued() $this->assertSame('Hi there', $response->getBody()); } - public function testSendProxied() - { - $request = $this->getRequest([ - 'base_uri' => 'http://www.foo.com/api/v1/', - 'delay' => 100, - ]); - - $request->setOutput("HTTP/1.1 200 Connection established\x0d\x0a\x0d\x0aHi there"); - $response = $request->get('answer'); - $this->assertSame('Hi there', $response->getBody()); - } - /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/3261 */ @@ -777,6 +765,21 @@ public function testSendContinuedWithManyHeaders() $this->assertSame(200, $response->getStatusCode()); } + public function testSendProxied() + { + $request = $this->getRequest([ + 'base_uri' => 'http://www.foo.com/api/v1/', + 'delay' => 100, + ]); + + $output = "HTTP/1.1 200 Connection established +Proxy-Agent: Fortinet-Proxy/1.0\x0d\x0a\x0d\x0aHTTP/1.1 200 OK\x0d\x0a\x0d\x0aHi there"; + $request->setOutput($output); + + $response = $request->get('answer'); + $this->assertSame('Hi there', $response->getBody()); + } + /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/7394 */ From e17ebddf11b7867bdf47529828404cc9d961c485 Mon Sep 17 00:00:00 2001 From: Christoph Potas Date: Mon, 26 Jun 2023 18:57:59 +0200 Subject: [PATCH 048/237] Fix sqlsrv default port connection refuse ~ ignore default port when constructr hostname for sqlsrv driver --- system/Database/SQLSRV/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index 4e0ca987df9a..445c6bf5426b 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -121,7 +121,7 @@ public function connect(bool $persistent = false) unset($connection['UID'], $connection['PWD']); } - if (strpos($this->hostname, ',') === false && $this->port !== '') { + if (strpos($this->hostname, ',') === false && $this->port !== '' && (int)$this->port !== 1433) { $this->hostname .= ', ' . $this->port; } From d3b217cf25ba69abf834a3d4aaa687826a5bc12e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 27 Jun 2023 09:50:12 +0900 Subject: [PATCH 049/237] chore: update Kint to 5.0.7 --- system/ThirdParty/Kint/Parser/Parser.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/ThirdParty/Kint/Parser/Parser.php b/system/ThirdParty/Kint/Parser/Parser.php index 5c7a40a3ac1a..50642b90a123 100644 --- a/system/ThirdParty/Kint/Parser/Parser.php +++ b/system/ThirdParty/Kint/Parser/Parser.php @@ -374,7 +374,11 @@ private function parseArray(array &$var, Value $o): Value } $stash = $val; - $copy[$i] = $refmarker; + try { + $copy[$i] = $refmarker; + } catch (TypeError $e) { + $child->reference = true; + } if ($val === $refmarker) { $child->reference = true; $val = $stash; From 19f88fbdc53d97e7f1770bbb067ab401a5bc2ece Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 27 Jun 2023 11:24:32 +0900 Subject: [PATCH 050/237] docs: fix incorrect description A named route cannot be used with RedirectException. --- user_guide_src/source/general/errors.rst | 2 +- user_guide_src/source/general/errors/010.php | 2 +- user_guide_src/source/general/errors/011.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index c46aed6572ce..163a7540084f 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -109,7 +109,7 @@ forcing a redirect to a specific route or URL: .. literalinclude:: errors/010.php -``$route`` may be a named route, relative URI, or a complete URL. You can also supply a +``$uri`` may be a URI path relative to baseURL, or a complete URL. You can also supply a redirect code to use instead of the default (``302``, "temporary redirect"): .. literalinclude:: errors/011.php diff --git a/user_guide_src/source/general/errors/010.php b/user_guide_src/source/general/errors/010.php index ff9cfee974ef..47ecb3c7853f 100644 --- a/user_guide_src/source/general/errors/010.php +++ b/user_guide_src/source/general/errors/010.php @@ -1,3 +1,3 @@ Date: Sun, 25 Jun 2023 23:47:42 -0500 Subject: [PATCH 051/237] chore: remove php-stan from the precommit hook --- admin/pre-commit | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/admin/pre-commit b/admin/pre-commit index ef13c4c7a43a..f64268277e72 100644 --- a/admin/pre-commit +++ b/admin/pre-commit @@ -20,22 +20,6 @@ if [ "$STAGED_PHP_FILES" != "" ]; then done fi -if [ "$FILES" != "" ]; then - echo "Running PHPStan..." - - # Run on whole codebase - if [ -d /proc/cygdrive ]; then - XDEBUG_MODE=off ./vendor/bin/phpstan analyse - else - XDEBUG_MODE=off php ./vendor/bin/phpstan analyse - fi - - if [ $? != 0 ]; then - echo "Fix the phpstan error(s) before commit." - exit 1 - fi -fi - if [ "$FILES" != "" ]; then echo "Running PHP CS Fixer..." From 29d6ddd2c26cd516800430ae880ae585eceba2bb Mon Sep 17 00:00:00 2001 From: Christoph Potas Date: Tue, 27 Jun 2023 12:14:58 +0200 Subject: [PATCH 052/237] Confirm Style Guide ~ add missing space (style guide) --- system/Database/SQLSRV/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index 445c6bf5426b..555b0a21c3f1 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -121,7 +121,7 @@ public function connect(bool $persistent = false) unset($connection['UID'], $connection['PWD']); } - if (strpos($this->hostname, ',') === false && $this->port !== '' && (int)$this->port !== 1433) { + if (strpos($this->hostname, ',') === false && $this->port !== '' && (int) $this->port !== 1433) { $this->hostname .= ', ' . $this->port; } From 8f245905488603f27ee3120c82c76496ebd85489 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 10:27:11 +0900 Subject: [PATCH 053/237] docs: remove incorrect description A complete URL will be converted with base_url(). --- user_guide_src/source/general/errors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 163a7540084f..f5c4e1bd3d55 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -109,7 +109,7 @@ forcing a redirect to a specific route or URL: .. literalinclude:: errors/010.php -``$uri`` may be a URI path relative to baseURL, or a complete URL. You can also supply a +``$uri`` is a URI path relative to baseURL. You can also supply a redirect code to use instead of the default (``302``, "temporary redirect"): .. literalinclude:: errors/011.php From c72573a27a5154b6ffc129d9fe16155f71f51a22 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 10:28:44 +0900 Subject: [PATCH 054/237] docs: remove `route` It may imply a named route. --- user_guide_src/source/general/errors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index f5c4e1bd3d55..6d6ddeb51e77 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -105,7 +105,7 @@ RedirectException ----------------- This exception is a special case allowing for overriding of all other response routing and -forcing a redirect to a specific route or URL: +forcing a redirect to a specific URI: .. literalinclude:: errors/010.php From 2d5fcb2a9d5440e3dfa5b5c7471905232e0f3e4a Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 11:11:20 +0900 Subject: [PATCH 055/237] docs: improve force_https() description --- user_guide_src/source/general/common_functions.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index a68d500ad315..5d41dde21fab 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -266,8 +266,11 @@ Miscellaneous Functions Checks to see if the page is currently being accessed via HTTPS. If it is, then nothing happens. If it is not, then the user is redirected back to the current URI - but through HTTPS. Will set the HTTP Strict Transport Security header, which instructs - modern browsers to automatically modify any HTTP requests to HTTPS requests for the $duration. + but through HTTPS. Will set the HTTP Strict Transport Security (HTST) header, which instructs + modern browsers to automatically modify any HTTP requests to HTTPS requests for the ``$duration``. + + .. note:: This function is also used when you set + ``Config\App:$forceGlobalSecureRequests`` to true. .. php:function:: function_usable($function_name) From 5fc525d94f52b31422e3606d44a3827ba324076f Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 11:14:24 +0900 Subject: [PATCH 056/237] docs: fix comment header --- app/Config/App.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Config/App.php b/app/Config/App.php index 67eaf7da4bf5..f04703ba228c 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -126,7 +126,7 @@ class App extends BaseConfig /** * -------------------------------------------------------------------------- - * URI PROTOCOL + * Force Global Secure Requests * -------------------------------------------------------------------------- * * If true, this will force every request made to this application to be From 31a1351ee55390a76dad4363250dfa7fbece93eb Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 17:50:54 +0900 Subject: [PATCH 057/237] docs: add link to php.net --- user_guide_src/source/libraries/time.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index c9baf8a8f597..d471ad8466f7 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -22,8 +22,12 @@ Instantiating ************* There are several ways that a new Time instance can be created. The first is simply to create a new instance -like any other class. When you do it this way, you can pass in a string representing the desired time. This can -be any string that PHP's strtotime function can parse: +like any other class. + +When you do it this way, you can pass in a string representing the desired time. This can +be any string that PHP's `strtotime()`_ function can parse: + +.. _strtotime(): https://www.php.net/manual/en/function.strtotime.php .. literalinclude:: time/001.php From dd94346a3abdaaac3ef8d14e63c101d318bf1c0b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 17:51:13 +0900 Subject: [PATCH 058/237] docs: text decration --- user_guide_src/source/libraries/time.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/time.rst b/user_guide_src/source/libraries/time.rst index d471ad8466f7..2175a8c681a3 100644 --- a/user_guide_src/source/libraries/time.rst +++ b/user_guide_src/source/libraries/time.rst @@ -163,7 +163,7 @@ toDateTimeString() ================== This is the first of three helper methods to work with the `IntlDateFormatter `_ without having to remember their values. -This will return a localized version of string formatted as (Y-m-d H:i:s): +This will return a localized version of string formatted as (``Y-m-d H:i:s``): .. literalinclude:: time/016.php From 6fd54273fbff3f11acace09b13f90b532be00b22 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Jun 2023 17:56:13 +0900 Subject: [PATCH 059/237] docs: change "with" in section titles to lowercase For consistency. --- user_guide_src/source/general/configuration.rst | 2 +- user_guide_src/source/general/logging.rst | 2 +- user_guide_src/source/libraries/uploaded_files.rst | 2 +- user_guide_src/source/models/entities.rst | 2 +- user_guide_src/source/outgoing/localization.rst | 2 +- user_guide_src/source/testing/response.rst | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 0ae9c2dab1c8..e9a1a7df2cad 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -15,7 +15,7 @@ the application configuration files in the **app/Config** folder. :local: :depth: 2 -Working With Configuration Files +Working with Configuration Files ******************************** You can access configuration files for your classes in several different ways. diff --git a/user_guide_src/source/general/logging.rst b/user_guide_src/source/general/logging.rst index da9ebd1344cd..6e159827b1e9 100644 --- a/user_guide_src/source/general/logging.rst +++ b/user_guide_src/source/general/logging.rst @@ -81,7 +81,7 @@ Each handler's section will have one property in common: ``handles``, which is a .. literalinclude:: logging/004.php -Modifying the Message With Context +Modifying the Message with Context ================================== You will often want to modify the details of your message based on the context of the event being logged. diff --git a/user_guide_src/source/libraries/uploaded_files.rst b/user_guide_src/source/libraries/uploaded_files.rst index b91b34ecd718..b202d1b2d0c3 100644 --- a/user_guide_src/source/libraries/uploaded_files.rst +++ b/user_guide_src/source/libraries/uploaded_files.rst @@ -231,7 +231,7 @@ In controller: .. note:: Using ``getFiles()`` is more appropriate. ********************* -Working With the File +Working with the File ********************* Once you've retrieved the UploadedFile instance, you can retrieve information about the file in safe ways, as well as diff --git a/user_guide_src/source/models/entities.rst b/user_guide_src/source/models/entities.rst index df625dd73833..8e1d99a3a973 100644 --- a/user_guide_src/source/models/entities.rst +++ b/user_guide_src/source/models/entities.rst @@ -57,7 +57,7 @@ are handled automatically by the class or the database, so we don't want to chan class as the ``$returnType``. This ensures that all methods on the model that return rows from the database will return instances of our User Entity class instead of an object or array like normal. -Working With the Entity Class +Working with the Entity Class ----------------------------- Now that all of the pieces are in place, you would work with the Entity class as you would any other class: diff --git a/user_guide_src/source/outgoing/localization.rst b/user_guide_src/source/outgoing/localization.rst index efae7ae5dc8b..103207c35961 100644 --- a/user_guide_src/source/outgoing/localization.rst +++ b/user_guide_src/source/outgoing/localization.rst @@ -7,7 +7,7 @@ Localization :depth: 3 ******************** -Working With Locales +Working with Locales ******************** CodeIgniter provides several tools to help you localize your application for different languages. While full diff --git a/user_guide_src/source/testing/response.rst b/user_guide_src/source/testing/response.rst index c28fd46bbb81..bf82bb402403 100644 --- a/user_guide_src/source/testing/response.rst +++ b/user_guide_src/source/testing/response.rst @@ -249,7 +249,7 @@ Asserts that an input tag exists with the name and value: .. literalinclude:: response/029.php -Working With JSON +Working with JSON ================= Responses will frequently contain JSON responses, especially when working with API methods. The following methods @@ -280,7 +280,7 @@ assertJSONExact($test) Similar to ``assertJSONFragment()``, but checks the entire JSON response to ensure exact matches. -Working With XML +Working with XML ================ getXML() From a7b97ad34e2198229708ddc440399174ebf237df Mon Sep 17 00:00:00 2001 From: Christoph Potas Date: Wed, 28 Jun 2023 15:11:34 +0200 Subject: [PATCH 060/237] Provide default port configuration information to the documentation ~ remove old port changes + add port config information to the documentation --- system/Database/SQLSRV/Connection.php | 2 +- user_guide_src/source/database/configuration.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index 555b0a21c3f1..4e0ca987df9a 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -121,7 +121,7 @@ public function connect(bool $persistent = false) unset($connection['UID'], $connection['PWD']); } - if (strpos($this->hostname, ',') === false && $this->port !== '' && (int) $this->port !== 1433) { + if (strpos($this->hostname, ',') === false && $this->port !== '') { $this->hostname .= ', ' . $this->port; } diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index bdb6320d0bb3..d2b6b893abe6 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -174,7 +174,7 @@ Explanation of Values: **compress** Whether or not to use client compression (``MySQLi`` only). **strictOn** true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application (``MySQLi`` only). -**port** The database port number. +**port** The database port number - Empty for default port (or dynamic port with ``SQLSRV``) **foreignKeys** true/false (boolean) - Whether or not to enable Foreign Key constraint (``SQLite3`` only). .. important:: SQLite3 Foreign Key constraint is disabled by default. From 2753ad7d89b70896f199a51798f89a417134ce0d Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 29 Jun 2023 16:57:14 +0900 Subject: [PATCH 061/237] docs: fix @param --- system/CodeIgniter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 2a777474c56e..5f51a2e175a5 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -732,7 +732,7 @@ public static function cache(int $time) * Caches the full response from the current request. Used for * full-page caching for very high performance. * - * @return mixed + * @return bool */ public function cachePage(Cache $config) { @@ -918,7 +918,7 @@ protected function createController() * 2. PHP CLI: accessed by CLI via php public/index.php, arguments become URI segments, * sent to Controllers via Routes, output varies * - * @param mixed $class + * @param Controller $class * * @return false|ResponseInterface|string|void */ From 757de43da5813a62633e1ce183dd0527d8f39c7f Mon Sep 17 00:00:00 2001 From: puschie286 Date: Thu, 29 Jun 2023 10:39:51 +0200 Subject: [PATCH 062/237] Update user_guide_src/source/database/configuration.rst Co-authored-by: kenjis --- user_guide_src/source/database/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index d2b6b893abe6..077231fa3dca 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -174,7 +174,7 @@ Explanation of Values: **compress** Whether or not to use client compression (``MySQLi`` only). **strictOn** true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application (``MySQLi`` only). -**port** The database port number - Empty for default port (or dynamic port with ``SQLSRV``) +**port** The database port number - Empty string ``''`` for default port (or dynamic port with ``SQLSRV``). **foreignKeys** true/false (boolean) - Whether or not to enable Foreign Key constraint (``SQLite3`` only). .. important:: SQLite3 Foreign Key constraint is disabled by default. From 70f566f5224af1b5ef35844f44ef91b22e8b1c4a Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Thu, 29 Jun 2023 18:24:08 +0800 Subject: [PATCH 063/237] docs: Add the type. --- system/BaseModel.php | 2 +- system/Model.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/BaseModel.php b/system/BaseModel.php index 8d5b4276eb43..06b8190f037f 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -1711,7 +1711,7 @@ protected function transformDataToArray($data, string $type): array * * @param string $name Name * - * @return array|bool|int|object|string|null + * @return array|bool|float|int|object|string|null */ public function __get(string $name) { diff --git a/system/Model.php b/system/Model.php index c28bf2b9da1c..b60bb966dd85 100644 --- a/system/Model.php +++ b/system/Model.php @@ -792,7 +792,7 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur * * @param string $name Name * - * @return array|BaseBuilder|bool|int|object|string|null + * @return array|BaseBuilder|bool|float|int|object|string|null */ public function __get(string $name) { @@ -821,7 +821,7 @@ public function __isset(string $name): bool * Provides direct access to method in the builder (if available) * and the database connection. * - * @return array|BaseBuilder|bool|float|int|object|string|null + * @return $this|array|BaseBuilder|bool|float|int|object|string|null */ public function __call(string $name, array $params) { From fccea01ba9185dd6592a1177b41a2fdea4a0a2fc Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 29 Jun 2023 21:20:00 +0900 Subject: [PATCH 064/237] fix: remove incorrect param type in number_to_roman() --- system/Helpers/number_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index c61229dad345..32dd4e09d68c 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -173,9 +173,9 @@ function format_number(float $num, int $precision = 1, ?string $locale = null, a /** * Convert a number to a roman numeral. * - * @param string $num it will convert to int + * @param int|string $num it will convert to int */ - function number_to_roman(string $num): ?string + function number_to_roman($num): ?string { static $map = [ 'M' => 1000, From 41dbea0c02e9dbda3fa2feaeab54084ac8604205 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 29 Jun 2023 21:23:02 +0900 Subject: [PATCH 065/237] docs: align comments --- user_guide_src/source/helpers/number_helper/009.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/helpers/number_helper/009.php b/user_guide_src/source/helpers/number_helper/009.php index 0a520a198943..a55daa265677 100644 --- a/user_guide_src/source/helpers/number_helper/009.php +++ b/user_guide_src/source/helpers/number_helper/009.php @@ -1,5 +1,5 @@ Date: Thu, 29 Jun 2023 21:23:23 +0900 Subject: [PATCH 066/237] docs: update reference --- user_guide_src/source/helpers/number_helper.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/helpers/number_helper.rst b/user_guide_src/source/helpers/number_helper.rst index d43967c502f7..0528aa07eee1 100644 --- a/user_guide_src/source/helpers/number_helper.rst +++ b/user_guide_src/source/helpers/number_helper.rst @@ -92,7 +92,7 @@ The following functions are available: .. php:function:: number_to_roman($num) - :param string $num: The number want to convert + :param int|string $num: The number want to convert :returns: The roman number converted from given parameter :rtype: string|null @@ -101,4 +101,4 @@ The following functions are available: .. literalinclude:: number_helper/009.php This function only handles numbers in the range 1 through 3999. - It will return null for any value outside that range. + It will return ``null`` for any value outside that range. From 8f6c2dba26146473d009a8b75a762c174c703028 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Jun 2023 15:21:50 +0000 Subject: [PATCH 067/237] chore(deps-dev): update rector/rector requirement from 0.17.1 to 0.17.2 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.1...0.17.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 674e51659808..c7da41b6b216 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.17.1", + "rector/rector": "0.17.2", "vimeo/psalm": "^5.0" }, "suggest": { From 4823409a4b26210aae463aa1eafaa04791c17782 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 30 Jun 2023 09:57:58 +0900 Subject: [PATCH 068/237] docs: update comment --- app/Config/Cache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 659d9ed6ae38..c19358ce8449 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -53,12 +53,12 @@ class Cache extends BaseConfig * Whether to take the URL query string into consideration when generating * output cache files. Valid options are: * - * false = Disabled - * true = Enabled, take all query parameters into account. - * Please be aware that this may result in numerous cache - * files generated for the same page over and over again. - * array('q') = Enabled, but only take into account the specified list - * of query parameters. + * false = Disabled + * true = Enabled, take all query parameters into account. + * Please be aware that this may result in numerous cache + * files generated for the same page over and over again. + * ['q'] = Enabled, but only take into account the specified list + * of query parameters. * * @var bool|string[] */ From a98b6f0e0524f2ff388a98a725b8148ddf326def Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 30 Jun 2023 10:20:26 +0900 Subject: [PATCH 069/237] docs: add "Configuring Caching" --- user_guide_src/source/general/caching.rst | 30 ++++++++++++++++++--- user_guide_src/source/libraries/caching.rst | 2 ++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst index 04a144141ff2..64af64405026 100644 --- a/user_guide_src/source/general/caching.rst +++ b/user_guide_src/source/general/caching.rst @@ -30,6 +30,33 @@ browser. .. note:: The Benchmark tag is not cached so you can still view your page load speed when caching is enabled. +Configuring Caching +=================== + +Setting Cache Engine +-------------------- + +Before using Web Page Caching, you must set the cache engine up by editing +**app/Config/Cache.php**. See :ref:`libraries-caching-configuring-the-cache` +for details. + +Setting $cacheQueryString +------------------------- + +You can set whether or not to include the query string when generating the cache +with ``Config\Cache::$cacheQueryString``. + +Valid options are: + +- ``false``: (default) Disabled. The query string is not taken into account; the + same cache is returned for requests with the same URI path but different query + strings. +- ``true``: Enabled, take all query parameters into account. Be aware that this + may result in numerous cache generated for the same page over and over + again. +- **array**: Enabled, but only take into account the specified list of query + parameters. E.g., ``['q', 'page']``. + Enabling Caching ================ @@ -48,9 +75,6 @@ you. Once the tag is in place, your pages will begin being cached. .. important:: If you change configuration options that might affect your output, you have to manually delete your cache files. -.. note:: Before the cache files can be written you must set the cache - engine up by editing **app/Config/Cache.php**. - Deleting Caches =============== diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 39834b0121bb..671c92cdb488 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -23,6 +23,8 @@ You can grab an instance of the cache engine directly through the Services class .. literalinclude:: caching/002.php +.. _libraries-caching-configuring-the-cache: + ********************* Configuring the Cache ********************* From 5f5a5be3337889637f5298bc500ad67e38b23c24 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 30 Jun 2023 10:22:46 +0900 Subject: [PATCH 070/237] docs: fix descriptions --- user_guide_src/source/general/caching.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst index 64af64405026..4d2426e30c26 100644 --- a/user_guide_src/source/general/caching.rst +++ b/user_guide_src/source/general/caching.rst @@ -21,8 +21,8 @@ How Does Caching Work? Caching can be enabled on a per-page basis, and you can set the length of time that a page should remain cached before being refreshed. When a -page is loaded for the first time, the file will be cached using the -currently configured cache engine. On subsequent page loads, the cache file +page is loaded for the first time, the page will be cached using the +currently configured cache engine. On subsequent page loads, the cache will be retrieved and sent to the requesting user's browser. If it has expired, it will be deleted and refreshed before being sent to the browser. @@ -73,12 +73,12 @@ the order that it appears, so place it wherever it seems most logical to you. Once the tag is in place, your pages will begin being cached. .. important:: If you change configuration options that might affect - your output, you have to manually delete your cache files. + your output, you have to manually delete your cache. Deleting Caches =============== -If you no longer wish to cache a file you can remove the caching tag and +If you no longer wish to cache a page you can remove the caching tag and it will no longer be refreshed when it expires. .. note:: Removing the tag will not delete the cache immediately. It will From 0ea35d6aff3f11be301ac0b568898329c37a4af6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 17 May 2023 11:55:13 +0900 Subject: [PATCH 071/237] docs: do not recomment to use PHP function It is a bad practice. --- user_guide_src/source/libraries/sessions.rst | 7 ++++--- user_guide_src/source/libraries/sessions/037.php | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 86b5212ad6a0..98c62d4e8c15 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -353,12 +353,13 @@ destroy() --------- To clear the current session (for example, during a logout), you may -simply use either PHP's `session_destroy() `_ -function, or the library's ``destroy()`` method. Both will work in exactly the -same way: +simply use the library's ``destroy()`` method: .. literalinclude:: sessions/037.php +This method will work in exactly the same way as PHP's +`session_destroy() `_ function. + .. note:: This must be the last session-related operation that you do during the same request. All session data (including flashdata and tempdata) will be destroyed permanently and functions will be diff --git a/user_guide_src/source/libraries/sessions/037.php b/user_guide_src/source/libraries/sessions/037.php index 1e7931f34f33..9f474a3c7d31 100644 --- a/user_guide_src/source/libraries/sessions/037.php +++ b/user_guide_src/source/libraries/sessions/037.php @@ -1,5 +1,3 @@ destroy(); From 12c7bb9ad9138bb43e0f1ec76ca107ab7ca63836 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 3 Jul 2023 11:03:52 +0900 Subject: [PATCH 072/237] docs: remove inaccurate description --- user_guide_src/source/libraries/sessions.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 98c62d4e8c15..3bda972a380f 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -360,10 +360,8 @@ simply use the library's ``destroy()`` method: This method will work in exactly the same way as PHP's `session_destroy() `_ function. -.. note:: This must be the last session-related operation that you do - during the same request. All session data (including flashdata and - tempdata) will be destroyed permanently and functions will be - unusable during the same request after you destroy the session. +This must be the last session-related operation that you do during the same request. +All session data (including flashdata and tempdata) will be destroyed permanently. .. _session-stop: From cba77132b8ff00f2a2a434301d80686ed5ee45f6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 3 Jul 2023 11:04:17 +0900 Subject: [PATCH 073/237] docs: add note --- user_guide_src/source/libraries/sessions.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 3bda972a380f..3c0e13d77552 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -363,6 +363,9 @@ This method will work in exactly the same way as PHP's This must be the last session-related operation that you do during the same request. All session data (including flashdata and tempdata) will be destroyed permanently. +.. note:: You do not have to call this method from usual code. Cleanup session + data rather than destroying the session. + .. _session-stop: stop() From 5cfefc011a3c2c4f4cfa132d6b041f84ca4e6e8b Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 3 Jul 2023 13:16:29 +0900 Subject: [PATCH 074/237] docs: add @phpstan-ignore-next-line in number_to_size() --- system/Helpers/number_helper.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 32dd4e09d68c..af0d6fb83cc8 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -24,8 +24,10 @@ function number_to_size($num, int $precision = 1, ?string $locale = null) { // Strip any formatting & ensure numeric input try { + // @phpstan-ignore-next-line $num = 0 + str_replace(',', '', $num); } catch (ErrorException $ee) { + // Catch "Warning: A non-numeric value encountered" return false; } From 6f93b8bf9ca669b60e68bc7e0d04ff8967dedfb0 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Sat, 24 Jun 2023 21:29:42 +0900 Subject: [PATCH 075/237] docs:replace type mixed at all helpers class. --- system/Helpers/array_helper.php | 6 +++--- system/Helpers/cookie_helper.php | 2 +- system/Helpers/filesystem_helper.php | 4 ++-- system/Helpers/number_helper.php | 4 ++-- system/Helpers/text_helper.php | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index 9b88cc2a0e0f..cdc1b81ab7f0 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -41,7 +41,7 @@ function dot_array_search(string $index, array $array) * * @internal This should not be used on its own. * - * @return mixed + * @return array|bool|float|int|object|string|null */ function _array_search_dot(array $indexes, array $array) { @@ -103,9 +103,9 @@ function _array_search_dot(array $indexes, array $array) /** * Returns the value of an element at a key in an array of uncertain depth. * - * @param mixed $key + * @param float|int|string $key * - * @return mixed|null + * @return array|bool|float|int|object|string|null */ function array_deep_search($key, array $array) { diff --git a/system/Helpers/cookie_helper.php b/system/Helpers/cookie_helper.php index cb5f227279d3..9fc004c28b9a 100755 --- a/system/Helpers/cookie_helper.php +++ b/system/Helpers/cookie_helper.php @@ -86,7 +86,7 @@ function get_cookie($index, bool $xssClean = false, ?string $prefix = '') /** * Delete a cookie * - * @param mixed $name + * @param string $name * @param string $domain the cookie domain. Usually: .yourdomain.com * @param string $path the cookie path * @param string $prefix the cookie prefix diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index 4918e87e7bf2..ba4dd66d7f84 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -292,8 +292,8 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r * Options are: name, server_path, size, date, readable, writable, executable, fileperms * Returns false if the file cannot be found. * - * @param string $file Path to file - * @param mixed $returnedValues Array or comma separated string of information returned + * @param string $file Path to file + * @param array|string|null $returnedValues Array or comma separated string of information returned * * @return array|null */ diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index af0d6fb83cc8..7983d669470b 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -15,8 +15,8 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @param mixed $num Will be cast as int - * @param string $locale + * @param array|int|string $num Will be cast as int + * @param string $locale * * @return bool|string */ diff --git a/system/Helpers/text_helper.php b/system/Helpers/text_helper.php index 2343a89bfafe..145515459eba 100755 --- a/system/Helpers/text_helper.php +++ b/system/Helpers/text_helper.php @@ -410,10 +410,10 @@ function word_wrap(string $str, int $charlim = 76): string * * This function will strip tags from a string, split it at its max_length and ellipsize * - * @param string $str String to ellipsize - * @param int $maxLength Max length of string - * @param mixed $position int (1|0) or float, .5, .2, etc for position to split - * @param string $ellipsis ellipsis ; Default '...' + * @param string $str String to ellipsize + * @param int $maxLength Max length of string + * @param float|int $position int (1|0) or float, .5, .2, etc for position to split + * @param string $ellipsis ellipsis ; Default '...' * * @return string Ellipsized string */ @@ -446,9 +446,9 @@ function ellipsize(string $str, int $maxLength, $position = 1, string $ellipsis * * Removes slashes contained in a string or in an array * - * @param mixed $str string or array + * @param array|string $str string or array * - * @return mixed string or array + * @return array|string string or array */ function strip_slashes($str) { From 753edef10fca6aafec347b69972e94dc9192c569 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Thu, 29 Jun 2023 18:28:59 +0800 Subject: [PATCH 076/237] docs: fix some type. --- system/Helpers/array_helper.php | 2 +- system/Helpers/filesystem_helper.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index cdc1b81ab7f0..c5c9d956a411 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -103,7 +103,7 @@ function _array_search_dot(array $indexes, array $array) /** * Returns the value of an element at a key in an array of uncertain depth. * - * @param float|int|string $key + * @param int|string $key * * @return array|bool|float|int|object|string|null */ diff --git a/system/Helpers/filesystem_helper.php b/system/Helpers/filesystem_helper.php index ba4dd66d7f84..47c829bbc3c6 100644 --- a/system/Helpers/filesystem_helper.php +++ b/system/Helpers/filesystem_helper.php @@ -292,8 +292,8 @@ function get_dir_file_info(string $sourceDir, bool $topLevelOnly = true, bool $r * Options are: name, server_path, size, date, readable, writable, executable, fileperms * Returns false if the file cannot be found. * - * @param string $file Path to file - * @param array|string|null $returnedValues Array or comma separated string of information returned + * @param string $file Path to file + * @param array|string $returnedValues Array or comma separated string of information returned * * @return array|null */ From 87f690620712ae4545193d48b6df795f9587fe6d Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Thu, 29 Jun 2023 18:30:05 +0800 Subject: [PATCH 077/237] docs: fix the type. --- system/Helpers/number_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 7983d669470b..ba79754f4fce 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -15,8 +15,8 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @param array|int|string $num Will be cast as int - * @param string $locale + * @param int|string $num Will be cast as int + * @param string $locale * * @return bool|string */ From 3240062e9152c6689c12b6f04f6a655165789759 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Thu, 29 Jun 2023 19:12:10 +0800 Subject: [PATCH 078/237] fix: fix some error. --- system/Helpers/number_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index ba79754f4fce..7983d669470b 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -15,8 +15,8 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @param int|string $num Will be cast as int - * @param string $locale + * @param array|int|string $num Will be cast as int + * @param string $locale * * @return bool|string */ From 5d7b8864341b0a737b8a81439b4ed126d35d587c Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Mon, 3 Jul 2023 13:35:24 +0800 Subject: [PATCH 079/237] fix: fix the conflict --- system/Helpers/number_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 7983d669470b..ba79754f4fce 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -15,8 +15,8 @@ /** * Formats a numbers as bytes, based on size, and adds the appropriate suffix * - * @param array|int|string $num Will be cast as int - * @param string $locale + * @param int|string $num Will be cast as int + * @param string $locale * * @return bool|string */ From b8524e805be4fea5b23b7d24fcfc70376452504f Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Fri, 30 Jun 2023 12:58:24 +0800 Subject: [PATCH 080/237] fix: Add one more limit type. --- system/Helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index ba79754f4fce..00efea9c2422 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -77,7 +77,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) { // Strip any formatting & ensure numeric input try { - $num = 0 + str_replace(',', '', $num); + $num = 0 + (int) str_replace(',', '', $num); } catch (ErrorException $ee) { return false; } From 63ba16fc102b4801a7b003f60baceb5fd22eed2c Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Fri, 30 Jun 2023 13:00:24 +0800 Subject: [PATCH 081/237] fix: fix the error. --- system/Helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 00efea9c2422..ba79754f4fce 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -77,7 +77,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) { // Strip any formatting & ensure numeric input try { - $num = 0 + (int) str_replace(',', '', $num); + $num = 0 + str_replace(',', '', $num); } catch (ErrorException $ee) { return false; } From bdd2b5049568ac47a83274cec2ad7cc385f5a94c Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Fri, 30 Jun 2023 14:45:47 +0800 Subject: [PATCH 082/237] fix: remove the phpstan message. --- phpstan-baseline.neon.dist | 5 ----- system/Helpers/number_helper.php | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist index a32d4fc11a79..c3eaed7ade31 100644 --- a/phpstan-baseline.neon.dist +++ b/phpstan-baseline.neon.dist @@ -155,11 +155,6 @@ parameters: count: 1 path: system/Helpers/filesystem_helper.php - - - message: "#^Binary operation \"\\+\" between 0 and string results in an error\\.$#" - count: 1 - path: system/Helpers/number_helper.php - - message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#" count: 1 diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index ba79754f4fce..4ce90aa6acde 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -69,7 +69,7 @@ function number_to_size($num, int $precision = 1, ?string $locale = null) * * @see https://simple.wikipedia.org/wiki/Names_for_large_numbers * - * @param string $num + * @param int|string $num * * @return bool|string */ @@ -77,7 +77,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) { // Strip any formatting & ensure numeric input try { - $num = 0 + str_replace(',', '', $num); + $num = 0 + (int) str_replace(',', '', $num); } catch (ErrorException $ee) { return false; } From d88d751976704c35b2d1ee5a6ab48665931c0e6a Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Mon, 3 Jul 2023 13:39:11 +0800 Subject: [PATCH 083/237] fix: changed by rector. --- system/Helpers/number_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 4ce90aa6acde..e37bba4eb09e 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -77,7 +77,7 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) { // Strip any formatting & ensure numeric input try { - $num = 0 + (int) str_replace(',', '', $num); + $num = (int) str_replace(',', '', $num); } catch (ErrorException $ee) { return false; } From 95cf346eb1eb9b3bdb7824d56c1d9969395bba36 Mon Sep 17 00:00:00 2001 From: ping-yee <611077101@mail.nknu.edu.tw> Date: Mon, 3 Jul 2023 13:44:38 +0800 Subject: [PATCH 084/237] fix: fix the phpstan --- system/Helpers/number_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index e37bba4eb09e..5f0e59232fb3 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -77,7 +77,8 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) { // Strip any formatting & ensure numeric input try { - $num = (int) str_replace(',', '', $num); + // @phpstan-ignore-next-line + $num = 0 + str_replace(',', '', $num); } catch (ErrorException $ee) { return false; } From 5f2cdd2bd03ec0c6b73dbba859a088c1672a788f Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 10:04:06 +0900 Subject: [PATCH 085/237] test: add tests for $params in call() --- tests/system/Test/FeatureTestTraitTest.php | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 0d0237301f98..71341ce079b4 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -358,6 +358,60 @@ public function testIsOkWithRedirects() $this->assertTrue($response->isOK()); } + public function testCallGetWithParams() + { + $this->withRoutes([ + [ + 'get', + 'home', + static fn () => json_encode(Services::request()->getGet()), + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->get('home', $data); + + $response->assertOK(); + $this->assertStringContainsString( + // All GET values will be strings. + '{"true":"1","false":"","int":"2","null":"","float":"1.23","string":"foo"}', + $response->getBody() + ); + } + + public function testCallPostWithParams() + { + $this->withRoutes([ + [ + 'post', + 'home', + static fn () => json_encode(Services::request()->getPost()), + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->post('home', $data); + + $response->assertOK(); + $this->assertStringContainsString( + // All POST values will be strings. + '{"true":"1","false":"","int":"2","null":"","float":"1.23","string":"foo"}', + $response->getBody() + ); + } + public function testCallWithJsonRequest() { $this->withRoutes([ From f7ef2780b80b3cd79201700bdff827d9313b2bc0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 10:06:22 +0900 Subject: [PATCH 086/237] test: add test values with various types --- tests/system/Test/FeatureTestTraitTest.php | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 71341ce079b4..2a38c29e02c9 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -421,9 +421,19 @@ public function testCallWithJsonRequest() '\Tests\Support\Controllers\Popcorn::echoJson', ], ]); - $response = $this->withBodyFormat('json')->call('post', 'home', ['foo' => 'bar']); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->withBodyFormat('json') + ->call('post', 'home', $data); + $response->assertOK(); - $response->assertJSONExact(['foo' => 'bar']); + $response->assertJSONExact($data); } public function testSetupRequestBodyWithParams() @@ -440,10 +450,18 @@ public function testSetupRequestBodyWithXml() { $request = $this->setupRequest('post', 'home'); - $request = $this->withBodyFormat('xml')->setRequestBody($request, ['foo' => 'bar']); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $request = $this->withBodyFormat('xml')->setRequestBody($request, $data); $expectedXml = ' -bar +121.23foo '; $this->assertSame($expectedXml, $request->getBody()); From d96be52008575eb7a3db923892b050bd153e7221 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 10:07:37 +0900 Subject: [PATCH 087/237] fix: FeatureTestTrait changes $params values passed to call() --- system/Test/FeatureTestTrait.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index f7a6d0609b19..fbe4231e1b40 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -156,7 +156,7 @@ public function call(string $method, string $path, ?array $params = null) $request = $this->setupRequest($method, $path); $request = $this->setupHeaders($request); $request = $this->populateGlobals($method, $request, $params); - $request = $this->setRequestBody($request); + $request = $this->setRequestBody($request, $params); // Initialize the RouteCollection if (! $routes = $this->routes) { @@ -369,12 +369,14 @@ protected function setRequestBody(Request $request, ?array $params = null): Requ if (empty($params)) { $params = $request->fetchGlobal('request'); } + $formatMime = ''; if ($this->bodyFormat === 'json') { $formatMime = 'application/json'; } elseif ($this->bodyFormat === 'xml') { $formatMime = 'application/xml'; } + if (! empty($formatMime) && ! empty($params)) { $formatted = Services::format()->getFormatter($formatMime)->format($params); $request->setBody($formatted); From 63296dedaf38ef7c81ffcb6e28b0065a7aba70ee Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 16:52:48 +0900 Subject: [PATCH 088/237] test: add tests for call() params and REQUEST --- tests/system/Test/FeatureTestTraitTest.php | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 2a38c29e02c9..2db6bcf964fc 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -385,6 +385,33 @@ public function testCallGetWithParams() ); } + public function testCallGetWithParamsAndREQEST() + { + $this->withRoutes([ + [ + 'get', + 'home', + static fn () => json_encode(Services::request()->fetchGlobal('request')), + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->get('home', $data); + + $response->assertOK(); + $this->assertStringContainsString( + // All GET values will be strings. + '{"true":"1","false":"","int":"2","null":"","float":"1.23","string":"foo"}', + $response->getBody() + ); + } + public function testCallPostWithParams() { $this->withRoutes([ @@ -412,6 +439,33 @@ public function testCallPostWithParams() ); } + public function testCallPostWithParamsAndREQUEST() + { + $this->withRoutes([ + [ + 'post', + 'home', + static fn () => json_encode(Services::request()->fetchGlobal('request')), + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->post('home', $data); + + $response->assertOK(); + $this->assertStringContainsString( + // All POST values will be strings. + '{"true":"1","false":"","int":"2","null":"","float":"1.23","string":"foo"}', + $response->getBody() + ); + } + public function testCallWithJsonRequest() { $this->withRoutes([ From 9981d44accf9561616a3dfbbe1d9cabb3be502b5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 17:11:53 +0900 Subject: [PATCH 089/237] test: add tests for PUT JSON request and REQUEST --- tests/system/Test/FeatureTestTraitTest.php | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 2db6bcf964fc..73a0293e5685 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -466,6 +466,54 @@ public function testCallPostWithParamsAndREQUEST() ); } + public function testCallPutWithJsonRequest() + { + $this->withRoutes([ + [ + 'put', + 'home', + '\Tests\Support\Controllers\Popcorn::echoJson', + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->withBodyFormat('json') + ->call('put', 'home', $data); + + $response->assertOK(); + $response->assertJSONExact($data); + } + + public function testCallPutWithJsonRequestAndREQUEST() + { + $this->withRoutes([ + [ + 'put', + 'home', + static fn () => json_encode(Services::request()->fetchGlobal('request')), + ], + ]); + $data = [ + 'true' => true, + 'false' => false, + 'int' => 2, + 'null' => null, + 'float' => 1.23, + 'string' => 'foo', + ]; + $response = $this->withBodyFormat('json') + ->call('put', 'home', $data); + + $response->assertOK(); + $this->assertStringContainsString('[]', $response->getBody()); + } + public function testCallWithJsonRequest() { $this->withRoutes([ From 10f5034ce678890e1c44e0e024c1791e72de56cc Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 17:13:11 +0900 Subject: [PATCH 090/237] docs: add @param --- system/Test/FeatureTestTrait.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index fbe4231e1b40..55210e4f1c84 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -137,6 +137,8 @@ public function skipEvents() * Calls a single URI, executes it, and returns a TestResponse * instance that can be used to run many assertions against. * + * @param string $method HTTP verb + * * @return TestResponse */ public function call(string $method, string $path, ?array $params = null) @@ -281,6 +283,8 @@ public function options(string $path, ?array $params = null) /** * Setup a Request object to use so that CodeIgniter * won't try to auto-populate some of the items. + * + * @param string $method HTTP verb */ protected function setupRequest(string $method, ?string $path = null): IncomingRequest { @@ -325,6 +329,8 @@ protected function setupHeaders(IncomingRequest $request) * * Always populate the GET vars based on the URI. * + * @param string $method HTTP verb + * * @return Request * * @throws ReflectionException From 903fee87f6e5a0784700f460c13bce6557362b2d Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 17:14:15 +0900 Subject: [PATCH 091/237] refactor: add () --- system/Test/FeatureTestTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 55210e4f1c84..27cd3bc16194 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -339,7 +339,7 @@ protected function populateGlobals(string $method, Request $request, ?array $par { // $params should set the query vars if present, // otherwise set it from the URL. - $get = ! empty($params) && $method === 'get' + $get = (! empty($params) && $method === 'get') ? $params : $this->getPrivateProperty($request->getUri(), 'query'); From 79b83c0e4058eec56203fe225c293449018c65ba Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 17:15:03 +0900 Subject: [PATCH 092/237] fix: incorrect REQUEST superglobal data --- system/Test/FeatureTestTrait.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 27cd3bc16194..1aa47dd639b2 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -344,11 +344,18 @@ protected function populateGlobals(string $method, Request $request, ?array $par : $this->getPrivateProperty($request->getUri(), 'query'); $request->setGlobal('get', $get); - if ($method !== 'get') { - $request->setGlobal($method, $params); + + if ($method === 'get') { + $request->setGlobal('request', $request->fetchGlobal('get')); } - $request->setGlobal('request', $params); + if ($method === 'post') { + $request->setGlobal($method, $params); + $request->setGlobal( + 'request', + $request->fetchGlobal('post') + $request->fetchGlobal('get') + ); + } $_SESSION = $this->session ?? []; From faa014cfeec7bdf92d1de926e786a62307117860 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 17:58:08 +0900 Subject: [PATCH 093/237] test: add test for JSON request Content-Type --- tests/system/Test/FeatureTestTraitTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 73a0293e5685..70ac13c7e0ff 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -548,6 +548,23 @@ public function testSetupRequestBodyWithParams() $this->assertSame('application/json', $request->header('Content-Type')->getValue()); } + public function testSetupJSONRequestBodyWithBody() + { + $request = $this->setupRequest('post', 'home'); + $request = $this->withBodyFormat('json') + ->withBody(json_encode(['foo1' => 'bar1'])) + ->setRequestBody($request); + + $this->assertJsonStringEqualsJsonString( + json_encode(['foo1' => 'bar1']), + $request->getBody() + ); + $this->assertSame( + 'application/json', + $request->header('Content-Type')->getValue() + ); + } + public function testSetupRequestBodyWithXml() { $request = $this->setupRequest('post', 'home'); From c7ec2c901c90142de6475a94dbfc9a2b0d49d509 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 18:00:00 +0900 Subject: [PATCH 094/237] fix: incorrect logic in setRequestBody() - When it is a JSON/XML request, REQUEST global should be empty. - When calling withBody() and withBodyFormat(), Content-Type is not set. --- system/Test/FeatureTestTrait.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 1aa47dd639b2..33f4d19ce5c0 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -367,22 +367,11 @@ protected function populateGlobals(string $method, Request $request, ?array $par * This allows the body to be formatted in a way that the controller is going to * expect as in the case of testing a JSON or XML API. * - * @param array|null $params The parameters to be formatted and put in the body. If this is empty, it will get the - * what has been loaded into the request global of the request class. + * @param array|null $params The parameters to be formatted and put in the body. */ protected function setRequestBody(Request $request, ?array $params = null): Request { - if (isset($this->requestBody) && $this->requestBody !== '') { - $request->setBody($this->requestBody); - - return $request; - } - if (isset($this->bodyFormat) && $this->bodyFormat !== '') { - if (empty($params)) { - $params = $request->fetchGlobal('request'); - } - $formatMime = ''; if ($this->bodyFormat === 'json') { $formatMime = 'application/json'; @@ -390,13 +379,21 @@ protected function setRequestBody(Request $request, ?array $params = null): Requ $formatMime = 'application/xml'; } - if (! empty($formatMime) && ! empty($params)) { + if ($formatMime !== '') { + $request->setHeader('Content-Type', $formatMime); + } + + if ($params !== null && $formatMime !== '') { $formatted = Services::format()->getFormatter($formatMime)->format($params); $request->setBody($formatted); - $request->setHeader('Content-Type', $formatMime); } } + // withBody() has higher priority than $params of withBodyFormat(). + if (isset($this->requestBody) && $this->requestBody !== '') { + $request->setBody($this->requestBody); + } + return $request; } } From d9d19c67d6408edc579d18e05706c926e00da19b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 18:55:49 +0900 Subject: [PATCH 095/237] docs: fix @param type --- system/Test/FeatureTestTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 33f4d19ce5c0..d28e59df8872 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -110,7 +110,7 @@ public function withBodyFormat(string $format) /** * Set the raw body for the request * - * @param mixed $body + * @param string $body * * @return $this */ From 963b2e27f63427b7242c901828d3016074ec8f08 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 18:57:13 +0900 Subject: [PATCH 096/237] refactor: remove uneeded isset() --- system/Test/FeatureTestTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index d28e59df8872..6653702eb61f 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -371,7 +371,7 @@ protected function populateGlobals(string $method, Request $request, ?array $par */ protected function setRequestBody(Request $request, ?array $params = null): Request { - if (isset($this->bodyFormat) && $this->bodyFormat !== '') { + if ($this->bodyFormat !== '') { $formatMime = ''; if ($this->bodyFormat === 'json') { $formatMime = 'application/json'; @@ -390,7 +390,7 @@ protected function setRequestBody(Request $request, ?array $params = null): Requ } // withBody() has higher priority than $params of withBodyFormat(). - if (isset($this->requestBody) && $this->requestBody !== '') { + if ($this->requestBody !== '') { $request->setBody($this->requestBody); } From d273222b7eb25d239a2b51ad53fed2cb9bca442b Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 21 Jun 2023 19:04:59 +0900 Subject: [PATCH 097/237] fix: [BC] change priority for request body "withBodyFormat() and $params of call()" has higher priority than withBody(). --- system/Test/FeatureTestTrait.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index 6653702eb61f..74529e77abca 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -371,6 +371,10 @@ protected function populateGlobals(string $method, Request $request, ?array $par */ protected function setRequestBody(Request $request, ?array $params = null): Request { + if ($this->requestBody !== '') { + $request->setBody($this->requestBody); + } + if ($this->bodyFormat !== '') { $formatMime = ''; if ($this->bodyFormat === 'json') { @@ -385,15 +389,11 @@ protected function setRequestBody(Request $request, ?array $params = null): Requ if ($params !== null && $formatMime !== '') { $formatted = Services::format()->getFormatter($formatMime)->format($params); + // "withBodyFormat() and $params of call()" has higher priority than withBody(). $request->setBody($formatted); } } - // withBody() has higher priority than $params of withBodyFormat(). - if ($this->requestBody !== '') { - $request->setBody($this->requestBody); - } - return $request; } } From 5fe0572c66a98a80164196a8f8d460e374b9424e Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 30 Jun 2023 08:42:54 +0900 Subject: [PATCH 098/237] docs: improve feature.rst --- user_guide_src/source/testing/feature.rst | 38 ++++++++++++++++------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/user_guide_src/source/testing/feature.rst b/user_guide_src/source/testing/feature.rst index f41212b4eba0..651d02eb7b8d 100644 --- a/user_guide_src/source/testing/feature.rst +++ b/user_guide_src/source/testing/feature.rst @@ -21,23 +21,31 @@ are called if you implement your own methods. .. literalinclude:: feature/001.php -Requesting A Page +Requesting a Page ================= Essentially, feature tests simply allows you to call an endpoint on your application and get the results back. -to do this, you use the ``call()`` method. The first parameter is the HTTP method to use (most frequently either GET or POST). -The second parameter is the path on your site to test. The third parameter accepts an array that is used to populate the -superglobal variables for the HTTP verb you are using. So, a method of **GET** would have the **$_GET** variable -populated, while a **post** request would have the **$_POST** array populated. +To do this, you use the ``call()`` method. + +1. The first parameter is the HTTP method to use (most frequently either GET or POST). +2. The second parameter is the URI path on your site to test. +3. The third parameter ``$params`` accepts an array that is used to populate the + superglobal variables for the HTTP verb you are using. So, a method of **GET** + would have the **$_GET** variable populated, while a **POST** request would + have the **$_POST** array populated. + + .. note:: The ``$params`` array does not make sense for every HTTP verb, but is + included for consistency. .. literalinclude:: feature/002.php +Shorthand Methods +----------------- + Shorthand methods for each of the HTTP verbs exist to ease typing and make things clearer: .. literalinclude:: feature/003.php -.. note:: The ``$params`` array does not make sense for every HTTP verb, but is included for consistency. - Setting Different Routes ------------------------ @@ -74,22 +82,28 @@ to send out emails. You can tell the system to skip any event handling with the .. literalinclude:: feature/007.php -Formatting The Request +Formatting the Request ----------------------- You can set the format of your request's body using the ``withBodyFormat()`` method. Currently this supports either -`json` or `xml`. This will take the parameters passed into ``call()``, ``post()``, ``get()``... and assign them to the -body of the request in the given format. This will also set the `Content-Type` header for your request accordingly. +``json`` or ``xml``. This is useful when testing JSON or XML APIs so that you can set the request in the form that the controller will expect. +This will take the parameters passed into ``call()``, ``post()``, ``get()``... and assign them to the +body of the request in the given format. + +This will also set the `Content-Type` header for your request accordingly. + .. literalinclude:: feature/008.php Setting the Body ---------------- You can set the body of your request with the ``withBody()`` method. This allows you to format the body how you want -to format it. It is recommended that you use this if you have more complicated XMLs to test. This will also not set -the Content-Type header for you so if you need that, you can set it with the ``withHeaders()`` method. +to format it. It is recommended that you use this if you have more complicated XMLs to test. + +This will not set +the `Content-Type` header for you. If you need that, you can set it with the ``withHeaders()`` method. Checking the Response ===================== From 3c430819148fc29a5423b81a04c2a3789519843f Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 30 Jun 2023 09:49:18 +0900 Subject: [PATCH 099/237] docs: add changelog, upgrade guide, and missing explanation for $params --- user_guide_src/source/changelogs/v4.3.7.rst | 4 ++++ .../source/installation/upgrade_437.rst | 21 +++++++++++++++++++ user_guide_src/source/testing/feature.rst | 9 +++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst index b167c0c48dcf..47fc19f161d1 100644 --- a/user_guide_src/source/changelogs/v4.3.7.rst +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -12,6 +12,10 @@ Release Date: Unreleased BREAKING ******** +- **FeatureTestTrait:** When using :ref:`withBodyFormat() `, + the priority of the request body has been changed. + See :ref:`Upgrading Guide ` for details. + Message Changes *************** diff --git a/user_guide_src/source/installation/upgrade_437.rst b/user_guide_src/source/installation/upgrade_437.rst index 36cac74545d7..389c145f4109 100644 --- a/user_guide_src/source/installation/upgrade_437.rst +++ b/user_guide_src/source/installation/upgrade_437.rst @@ -18,6 +18,27 @@ Mandatory File Changes Breaking Changes **************** +.. _upgrade-437-feature-testing: + +Feature Testing Request Body +============================ + +If you call: + +1. :ref:`withBody() ` +2. and :ref:`withBodyFormat() ` +3. and pass the ``$params`` to :ref:`call() ` (or shorthand methods) + +the priority for a Request body has been changed. In the unlikely event that you +have test code affected by this change, modify it. + +For example, now the ``$params`` is used to build the request body, and the ``$body`` +is not used:: + + $this->withBody($body)->withBodyFormat('json')->call('post', $params) + +Previously, the ``$body`` was used for the request body. + Breaking Enhancements ********************* diff --git a/user_guide_src/source/testing/feature.rst b/user_guide_src/source/testing/feature.rst index 651d02eb7b8d..f113eab68cce 100644 --- a/user_guide_src/source/testing/feature.rst +++ b/user_guide_src/source/testing/feature.rst @@ -21,6 +21,8 @@ are called if you implement your own methods. .. literalinclude:: feature/001.php +.. _feature-requesting-a-page: + Requesting a Page ================= @@ -32,7 +34,8 @@ To do this, you use the ``call()`` method. 3. The third parameter ``$params`` accepts an array that is used to populate the superglobal variables for the HTTP verb you are using. So, a method of **GET** would have the **$_GET** variable populated, while a **POST** request would - have the **$_POST** array populated. + have the **$_POST** array populated. The ``$params`` is also used in + :ref:`feature-formatting-the-request`. .. note:: The ``$params`` array does not make sense for every HTTP verb, but is included for consistency. @@ -82,6 +85,8 @@ to send out emails. You can tell the system to skip any event handling with the .. literalinclude:: feature/007.php +.. _feature-formatting-the-request: + Formatting the Request ----------------------- @@ -96,6 +101,8 @@ This will also set the `Content-Type` header for your request accordingly. .. literalinclude:: feature/008.php +.. _feature-setting-the-body: + Setting the Body ---------------- From f1509f1c9eeaa2e2536b66b980e43af2bf681d10 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 4 Jul 2023 08:41:47 +0900 Subject: [PATCH 100/237] test: fix typo in method name Co-authored-by: MGatner --- tests/system/Test/FeatureTestTraitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 70ac13c7e0ff..33a29d522f47 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -385,7 +385,7 @@ public function testCallGetWithParams() ); } - public function testCallGetWithParamsAndREQEST() + public function testCallGetWithParamsAndREQUEST() { $this->withRoutes([ [ From 54ebb52eadabfdfbd30411b826ded994886bbde1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 4 Jul 2023 09:26:21 +0900 Subject: [PATCH 101/237] test: add test for missing argument --- tests/system/Helpers/URLHelper/MiscUrlTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index 7f5d9667501a..b943722d3908 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -17,6 +17,7 @@ use CodeIgniter\Router\Exceptions\RouterException; use CodeIgniter\Test\CIUnitTestCase; use Config\App; +use InvalidArgumentException; /** * @backupGlobals enabled @@ -900,4 +901,20 @@ public function testUrlToWithSupportedLocaleInRoute() url_to('path-to', 'string', 13, 'en') ); } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/7651 + */ + public function testUrlToMissingArgument() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Missing argument for "([a-zA-Z]+)" in route "([a-zA-Z]+)/login".'); + + $routes = Services::routes(); + $routes->group('(:alpha)', static function ($routes) { + $routes->match(['get'], 'login', 'Common\LoginController::loginView', ['as' => 'loginURL']); + }); + + url_to('loginURL'); + } } From 2ff1dc887f54ed1faa71593b62a547ade522e79e Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 4 Jul 2023 09:26:42 +0900 Subject: [PATCH 102/237] fix: improve exception message --- system/Router/RouteCollection.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 965a0c746ce7..9dbeefc33569 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1239,6 +1239,11 @@ protected function buildReverseRoute(string $from, array $params): string // Build our resulting string, inserting the $params in // the appropriate places. foreach ($matches[0] as $index => $pattern) { + if (! isset($params[$index])) { + throw new InvalidArgumentException( + 'Missing argument for "' . $pattern . '" in route "' . $from . '".' + ); + } if (! preg_match('#^' . $pattern . '$#u', $params[$index])) { throw RouterException::forInvalidParameterType(); } From 7131946ee491916e4342ac5ca7b1ba8f5c7c53f7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 10:49:14 +0900 Subject: [PATCH 103/237] docs: improve sample code If a dev copy and paste the constructor, it won't work becaseu `parent::__construct();` is missing. --- user_guide_src/source/database/configuration/008.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/user_guide_src/source/database/configuration/008.php b/user_guide_src/source/database/configuration/008.php index 5639c484d125..9073ee71ff4f 100644 --- a/user_guide_src/source/database/configuration/008.php +++ b/user_guide_src/source/database/configuration/008.php @@ -4,14 +4,20 @@ use CodeIgniter\Database\Config; +/** + * Database Configuration + */ class Database extends Config { + // ... public $development = [/* ... */]; public $test = [/* ... */]; public $production = [/* ... */]; public function __construct() { + // ... + $this->defaultGroup = ENVIRONMENT; } } From d91fb77195a6c293ac38dfc3f26a97a3e1e3f348 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:18:31 +0900 Subject: [PATCH 104/237] docs: fix @param in CLIRequest --- system/HTTP/CLIRequest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system/HTTP/CLIRequest.php b/system/HTTP/CLIRequest.php index dd4733e97c86..31b0f36f7ff6 100644 --- a/system/HTTP/CLIRequest.php +++ b/system/HTTP/CLIRequest.php @@ -221,7 +221,7 @@ public function isCLI(): bool * * @param array|string|null $index Index for item to fetch from $_GET. * @param int|null $filter A filter name to apply. - * @param mixed|null $flags + * @param array|int|null $flags * * @return array|null */ @@ -235,7 +235,7 @@ public function getGet($index = null, $filter = null, $flags = null) * * @param array|string|null $index Index for item to fetch from $_POST. * @param int|null $filter A filter name to apply - * @param mixed $flags + * @param array|int|null $flags * * @return array|null */ @@ -249,7 +249,7 @@ public function getPost($index = null, $filter = null, $flags = null) * * @param array|string|null $index Index for item to fetch from $_POST or $_GET * @param int|null $filter A filter name to apply - * @param mixed $flags + * @param array|int|null $flags * * @return array|null */ @@ -263,7 +263,7 @@ public function getPostGet($index = null, $filter = null, $flags = null) * * @param array|string|null $index Index for item to be fetched from $_GET or $_POST * @param int|null $filter A filter name to apply - * @param mixed $flags + * @param array|int|null $flags * * @return array|null */ From 752eddcf766a430d745fd9b276edb353ec1b5d57 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:18:57 +0900 Subject: [PATCH 105/237] docs: fix @return in FilterInterface --- system/Filters/FilterInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Filters/FilterInterface.php b/system/Filters/FilterInterface.php index 8055d11e7949..1a3363c90866 100644 --- a/system/Filters/FilterInterface.php +++ b/system/Filters/FilterInterface.php @@ -31,7 +31,7 @@ interface FilterInterface * * @param array|null $arguments * - * @return mixed + * @return RequestInterface|ResponseInterface|string|void */ public function before(RequestInterface $request, $arguments = null); @@ -43,7 +43,7 @@ public function before(RequestInterface $request, $arguments = null); * * @param array|null $arguments * - * @return mixed + * @return ResponseInterface|void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null); } From ab19d07cfab235bb77bbf7b4079392397b81618e Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:19:19 +0900 Subject: [PATCH 106/237] docs: fix typo in OCI8\Connection --- system/Database/OCI8/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/OCI8/Connection.php b/system/Database/OCI8/Connection.php index ce6554ddc63a..dd54bf9d4a11 100644 --- a/system/Database/OCI8/Connection.php +++ b/system/Database/OCI8/Connection.php @@ -98,7 +98,7 @@ class Connection extends BaseConnection public $lastInsertedTableName; /** - * confirm DNS format. + * confirm DSN format. */ private function isValidDSN(): bool { From 90089c90bb89b03525844768414e4235014bbfa2 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:20:10 +0900 Subject: [PATCH 107/237] docs: fix versions of @deprecated --- system/CLI/CLI.php | 2 +- system/Model.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 80d001a354ac..2798319b057d 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -520,7 +520,7 @@ public static function wait(int $seconds, bool $countdown = false) /** * if operating system === windows * - * @deprecated v4.3 Use `is_windows()` instead + * @deprecated 4.3.0 Use `is_windows()` instead */ public static function isWindows(): bool { diff --git a/system/Model.php b/system/Model.php index b60bb966dd85..a9c8e4f2eba9 100644 --- a/system/Model.php +++ b/system/Model.php @@ -866,7 +866,7 @@ private function checkBuilderMethod(string $name): void * * @codeCoverageIgnore * - * @deprecated since 4.1 + * @deprecated 4.1.0 */ public static function classToArray($data, $primaryKey = null, string $dateFormat = 'datetime', bool $onlyChanged = true): array { From 97dfb4a1e762ac9b0e8b573ebc2cfa19b8550510 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:20:48 +0900 Subject: [PATCH 108/237] docs: fix @var in UserAgent --- system/HTTP/UserAgent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/HTTP/UserAgent.php b/system/HTTP/UserAgent.php index 10088111cec1..ff1c68c4d54c 100644 --- a/system/HTTP/UserAgent.php +++ b/system/HTTP/UserAgent.php @@ -91,7 +91,7 @@ class UserAgent /** * HTTP Referer * - * @var mixed + * @var bool|string|null */ protected $referrer; From 960cb91340ff205e7de4b585e41aab0179cf3839 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:21:23 +0900 Subject: [PATCH 109/237] docs: fix @param in URI --- system/HTTP/URI.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index dee9365ded51..b88712e18c76 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -557,7 +557,7 @@ public function getSegment(int $number, string $default = ''): string * Set the value of a specific segment of the URI path. * Allows to set only existing segments or add new one. * - * @param mixed $value (string or int) + * @param int|string $value (string or int) * * @return $this */ @@ -844,7 +844,7 @@ public function setQueryArray(array $query) /** * Adds a single new element to the query vars. * - * @param mixed $value + * @param int|string $value * * @return $this */ From 2cda17f9e41fd287b45b5d50437b0005da2df53a Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:21:49 +0900 Subject: [PATCH 110/237] docs: fix @param in CURLRequest --- system/HTTP/CURLRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 616ef143fde8..019b12e2b8df 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -263,7 +263,7 @@ public function setForm(array $params, bool $multipart = false) /** * Set JSON data to be sent. * - * @param mixed $data + * @param array|bool|float|int|object|string|null $data * * @return $this */ From b6ed0ae91a077f6e4e1158428bcd0cb6bf2f4d54 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:22:14 +0900 Subject: [PATCH 111/237] docs: fix @param in MessageInterface --- system/HTTP/MessageInterface.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/MessageInterface.php b/system/HTTP/MessageInterface.php index ac4ccf416bb3..99867bde5800 100644 --- a/system/HTTP/MessageInterface.php +++ b/system/HTTP/MessageInterface.php @@ -30,7 +30,7 @@ public function getProtocolVersion(): string; /** * Sets the body of the current message. * - * @param mixed $data + * @param string $data * * @return $this */ @@ -48,7 +48,7 @@ public function getBody(); /** * Appends data to the body of the current message. * - * @param mixed $data + * @param string $data * * @return $this */ From 684e478edf430dc34ca1d817f5368958c4b24b29 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:22:35 +0900 Subject: [PATCH 112/237] docs: fix @return in ResponseTrait --- system/HTTP/ResponseTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/HTTP/ResponseTrait.php b/system/HTTP/ResponseTrait.php index 6bec1c90234f..2ab026c9ba82 100644 --- a/system/HTTP/ResponseTrait.php +++ b/system/HTTP/ResponseTrait.php @@ -307,7 +307,7 @@ public function getXML() * @param array|object|string $body * @param string $format Valid: json, xml * - * @return mixed + * @return false|string * * @throws InvalidArgumentException If the body property is not string or array. */ From 563ef336615aa89489a2b896d10486fae24b1039 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:22:57 +0900 Subject: [PATCH 113/237] docs: fix @param in RouteCollection --- system/Router/RouteCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 9dbeefc33569..3f728da77ce3 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -409,7 +409,7 @@ public function setAutoRoute(bool $value): RouteCollectionInterface * * This setting is passed to the Router class and handled there. * - * @param callable|null $callable + * @param callable|string|null $callable */ public function set404Override($callable = null): RouteCollectionInterface { From 96d92dd80895bb1856a6fcd6139b6f52a5ac227f Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:23:17 +0900 Subject: [PATCH 114/237] docs: fix @param in MessageTrait --- system/HTTP/MessageTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/HTTP/MessageTrait.php b/system/HTTP/MessageTrait.php index 7e2665d09157..e565c8d9827f 100644 --- a/system/HTTP/MessageTrait.php +++ b/system/HTTP/MessageTrait.php @@ -59,7 +59,7 @@ public function setBody($data): self /** * Appends data to the body of the current message. * - * @param mixed $data + * @param string $data * * @return $this */ From 9f1fdc648665b33907694d784f972df1e0883469 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:23:38 +0900 Subject: [PATCH 115/237] docs: fix @return in FileCollection --- system/HTTP/Files/FileCollection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 87f31ee511ea..37c44a88d45d 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -159,7 +159,7 @@ protected function populateFiles() * Given a file array, will create UploadedFile instances. Will * loop over an array and create objects for each. * - * @return array|UploadedFile + * @return UploadedFile|UploadedFile[] */ protected function createFileObject(array $array) { @@ -240,7 +240,7 @@ protected function fixFilesArray(array $data): array * @param array $index The index sequence we are navigating down * @param array $value The portion of the array to process * - * @return mixed + * @return UploadedFile|null */ protected function getValueDotNotationSyntax(array $index, array $value) { From eb22231b899ed00705e05e7277e818653709d0a7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:24:12 +0900 Subject: [PATCH 116/237] docs: improve comments in Validation --- system/Validation/Validation.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 5e539561271a..cbfd396f325f 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -462,14 +462,14 @@ public function withRequest(RequestInterface $request): ValidationInterface } /** - * Sets an individual rule and custom error messages for a single field. + * Sets (or adds) an individual rule and custom error messages for a single + * field. * * The custom error message should be just the messages that apply to * this field, like so: - * * [ - * 'rule' => 'message', - * 'rule' => 'message', + * 'rule1' => 'message1', + * 'rule2' => 'message2', * ] * * @param array|string $rules @@ -502,8 +502,8 @@ public function setRule(string $field, ?string $label, $rules, array $errors = [ /** * Stores the rules that should be used to validate the items. - * Rules should be an array formatted like: * + * Rules should be an array formatted like: * [ * 'field' => 'rule1|rule2' * ] @@ -511,12 +511,12 @@ public function setRule(string $field, ?string $label, $rules, array $errors = [ * The $errors array should be formatted like: * [ * 'field' => [ - * 'rule' => 'message', - * 'rule' => 'message + * 'rule1' => 'message1', + * 'rule2' => 'message2', * ], * ] * - * @param array $errors // An array of custom error messages + * @param array $errors An array of custom error messages */ public function setRules(array $rules, array $errors = []): ValidationInterface { From 8d175b250dd5eb04297adb3ad3962e826225ccd0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:36:42 +0900 Subject: [PATCH 117/237] docs: fix text decoration --- .../source/installation/running.rst | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index e858adc91d6c..3fe5a1659eba 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -45,7 +45,7 @@ Initial Configuration run using the "production" environment. See also :ref:`environment-constant`. .. note:: If you will be running your site using a web server (e.g., Apache or Nginx), - you will need to modify the permissions for the ``writable`` folder inside + you will need to modify the permissions for the **writable** folder inside your project, so that it is writable by the user or account used by your web server. @@ -64,8 +64,8 @@ This will launch the server and you can now view your application in your browse be used on a production server. If you need to run the site on a host other than simply localhost, you'll first need to add the host -to your ``hosts`` file. The exact location of the file varies in each of the main operating systems, though -all unix-type systems (include OS X) will typically keep the file at **/etc/hosts**. +to your **hosts** file. The exact location of the file varies in each of the main operating systems, though +all unix-type systems (include macOS) will typically keep the file at **/etc/hosts**. The local development server can be customized with three command line options: @@ -99,12 +99,12 @@ The "mod_rewrite" module enables URLs without "index.php" in them, and is assume in our user guide. Make sure that the rewrite module is enabled (uncommented) in the main -configuration file, e.g., ``apache2/conf/httpd.conf``:: +configuration file, e.g., **apache2/conf/httpd.conf**:: LoadModule rewrite_module modules/mod_rewrite.so -Also make sure that the default document root's element enables this too, -in the "AllowOverride" setting:: +Also make sure that the default document root's ```` element enables this too, +in the ``AllowOverride`` setting:: Options Indexes FollowSymLinks @@ -124,18 +124,18 @@ We recommend using "virtual hosting" to run your apps. You can set up different aliases for each of the apps you work on, Make sure that the virtual hosting module is enabled (uncommented) in the main -configuration file, e.g., ``apache2/conf/httpd.conf``:: +configuration file, e.g., **apache2/conf/httpd.conf**:: LoadModule vhost_alias_module modules/mod_vhost_alias.so -Add a host alias in your "hosts" file, typically ``/etc/hosts`` on unix-type platforms, -or ``c:/Windows/System32/drivers/etc/hosts`` on Windows. -Add a line to the file. This could be "myproject.local" or "myproject.test", for instance:: +Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms, +or **c:/Windows/System32/drivers/etc/hosts** on Windows. +Add a line to the file. This could be ``myproject.local`` or ``myproject.test``, for instance:: 127.0.0.1 myproject.local -Add a element for your webapp inside the virtual hosting configuration, -e.g., ``apache2/conf/extra/httpd-vhost.conf``:: +Add a ```` element for your webapp inside the virtual hosting configuration, +e.g., **apache2/conf/extra/httpd-vhost.conf**:: DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public" @@ -145,18 +145,18 @@ e.g., ``apache2/conf/extra/httpd-vhost.conf``:: If your project folder is not a subfolder of the Apache document root, then your - element may need a nested element to grant the web server access to the files. +```` element may need a nested ```` element to grant the web server access to the files. -With mod_userdir (shared hosts) +With mod_userdir (Shared Hosts) -------------------------------- A common practice in shared hosting environments is to use the Apache module "mod_userdir" to enable per-user Virtual Hosts automatically. Additional configuration is required to allow CodeIgniter4 to be run from these per-user directories. The following assumes that the server is already configured for mod_userdir. A guide to enabling this module is available `in the Apache documentation `_. -Because CodeIgniter4 expects the server to find the framework front controller at ``/public/index.php`` by default, you must specify this location as an alternative to search for the request (even if CodeIgniter4 is installed within the per-user web directory). +Because CodeIgniter4 expects the server to find the framework front controller at **public/index.php** by default, you must specify this location as an alternative to search for the request (even if CodeIgniter4 is installed within the per-user web directory). -The default user web directory ``~/public_html`` is specified by the ``UserDir`` directive, typically in ``/apache2/mods-available/userdir.conf`` or ``/apache2/conf/extra/httpd-userdir.conf``:: +The default user web directory **~/public_html** is specified by the ``UserDir`` directive, typically in **apache2/mods-available/userdir.conf** or **apache2/conf/extra/httpd-userdir.conf**:: UserDir public_html @@ -164,7 +164,7 @@ So you will need to configure Apache to look for CodeIgniter's public directory UserDir "public_html/public" "public_html" -Be sure to specify options and permissions for the CodeIgniter public directory as well. A ``userdir.conf`` might look like:: +Be sure to specify options and permissions for the CodeIgniter public directory as well. A **userdir.conf** might look like:: UserDir "public_html/public" "public_html" @@ -221,7 +221,7 @@ See :ref:`Handling Multiple Environments `. Testing ------- -With the above configuration, your webapp would be accessed with the URL ``http://myproject.local`` in your browser. +With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser. Apache needs to be restarted whenever you change its configuration. @@ -279,7 +279,7 @@ Bootstrapping the App In some scenarios you will want to load the framework without actually running the whole application. This is particularly useful for unit testing your project, but may also be handy for using third-party tools to analyze and modify your code. The framework comes -with a separate bootstrap script specifically for this scenario: ``system/Test/bootstrap.php``. +with a separate bootstrap script specifically for this scenario: **system/Test/bootstrap.php**. Most of the paths to your project are defined during the bootstrap process. You may use pre-defined constants to override these, but when using the defaults be sure that your From b4ea83bb55b7fd3ae40427d12323e53de1d93ae5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:37:29 +0900 Subject: [PATCH 118/237] docs: update PHP version for sample --- user_guide_src/source/installation/running.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 3fe5a1659eba..16c6f6b852ad 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -229,7 +229,7 @@ Hosting with Nginx ================== Nginx is the second most widely used HTTP server for web hosting. -Here you can find an example configuration using PHP 7.3 FPM (unix sockets) under Ubuntu Server. +Here you can find an example configuration using PHP 8.1 FPM (unix sockets) under Ubuntu Server. default.conf ------------ @@ -255,7 +255,7 @@ This configuration enables URLs without "index.php" in them and using CodeIgnite include snippets/fastcgi-php.conf; # With php-fpm: - fastcgi_pass unix:/run/php/php7.3-fpm.sock; + fastcgi_pass unix:/run/php/php8.1-fpm.sock; # With php-cgi: # fastcgi_pass 127.0.0.1:9000; } From c4b2e1e3b40736d2d2238ecde5dfa721a05871f3 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 5 Jul 2023 16:38:13 +0900 Subject: [PATCH 119/237] docs: minor improvements --- user_guide_src/source/installation/running.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 16c6f6b852ad..8a77c9b71f20 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -53,7 +53,7 @@ Local Development Server ======================== CodeIgniter 4 comes with a local development server, leveraging PHP's built-in web server -with CodeIgniter routing. You can use the ``serve`` script to launch it, +with CodeIgniter routing. You can use the ``spark serve`` command to launch it, with the following command line in the main directory:: > php spark serve @@ -87,7 +87,7 @@ Hosting with Apache =================== A CodeIgniter4 webapp is normally hosted on a web server. -Apache's ``httpd`` is the "standard" platform, and assumed in much of our documentation. +Apache HTTP Server is the "standard" platform, and assumed in much of our documentation. Apache is bundled with many platforms, but can also be downloaded in a bundle with a database engine and PHP from `Bitnami `_. From 13287e786d1094be881f6d15e375756046687455 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 5 Jul 2023 19:43:01 +0700 Subject: [PATCH 120/237] Make typed property for ResponseTraitTest --- tests/system/API/ResponseTraitTest.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index 653cac115f21..b8a522da86dd 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -29,16 +29,8 @@ */ final class ResponseTraitTest extends CIUnitTestCase { - /** - * @var MockIncomingRequest|null - */ - private $request; - - /** - * @var MockResponse|null - */ - private $response; - + private ?MockIncomingRequest $request = null; + private ?MockResponse $response = null; private ?FormatterInterface $formatter = null; protected function setUp(): void From 5a5bfaef0b4eee5fba5382ece823bc1258358112 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 08:25:40 +0900 Subject: [PATCH 121/237] docs: fix by proofreading Co-authored-by: Michal Sniatala --- user_guide_src/source/installation/running.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 8a77c9b71f20..4b08568866f9 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -53,8 +53,8 @@ Local Development Server ======================== CodeIgniter 4 comes with a local development server, leveraging PHP's built-in web server -with CodeIgniter routing. You can use the ``spark serve`` command to launch it, -with the following command line in the main directory:: +with CodeIgniter routing. You can launch it, with the following command line +in the main directory:: > php spark serve From 77a7d27e9b98fd03cd80c35880b69370fd388938 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 13:06:17 +0900 Subject: [PATCH 122/237] docs: fix by proofreading Co-authored-by: John Paul E. Balandan, CPA --- user_guide_src/source/installation/running.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 4b08568866f9..0b974180f7e7 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -65,7 +65,7 @@ This will launch the server and you can now view your application in your browse If you need to run the site on a host other than simply localhost, you'll first need to add the host to your **hosts** file. The exact location of the file varies in each of the main operating systems, though -all unix-type systems (include macOS) will typically keep the file at **/etc/hosts**. +all unix-type systems (including macOS) will typically keep the file at **/etc/hosts**. The local development server can be customized with three command line options: From 73aded644761abb4f9dcaf4c00ad9bc5aae9ba5c Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 14:33:31 +0900 Subject: [PATCH 123/237] docs: fix text decoration --- user_guide_src/source/outgoing/view_cells.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_cells.rst b/user_guide_src/source/outgoing/view_cells.rst index c797ec4bd8e4..09a6f5b6c12a 100644 --- a/user_guide_src/source/outgoing/view_cells.rst +++ b/user_guide_src/source/outgoing/view_cells.rst @@ -119,7 +119,7 @@ At the most basic level, all you need to implement within the class are public p Generating Cell via Command =========================== -You can also create a controlled cell via a built in command from the CLI. The command is ``php spark make:cell``. It takes one argument, the name of the cell to create. The name should be in PascalCase, and the class will be created in the ``app/Cells`` directory. The view file will also be created in the ``app/Cells`` directory. +You can also create a controlled cell via a built in command from the CLI. The command is ``php spark make:cell``. It takes one argument, the name of the cell to create. The name should be in PascalCase, and the class will be created in the **app/Cells** directory. The view file will also be created in the **app/Cells** directory. :: From da067273a7e55e73aa59f413d6b14d201cfe59d5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 14:33:46 +0900 Subject: [PATCH 124/237] docs: add sub section titles, etc. --- user_guide_src/source/outgoing/view_cells.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/outgoing/view_cells.rst b/user_guide_src/source/outgoing/view_cells.rst index 09a6f5b6c12a..cad0d3e392a4 100644 --- a/user_guide_src/source/outgoing/view_cells.rst +++ b/user_guide_src/source/outgoing/view_cells.rst @@ -16,17 +16,27 @@ CodeIgniter supports two types of View Cells: simple and controlled. Simple View Calling a View Cell ******************* -No matter which type of View Cell you are using, you can call it from any view by using the ``view_cell()`` helper method. The first parameter is the name of the class and method to call, and the second parameter is an array of parameters to pass to the method. The method must return a string, which will be inserted into the view where the ``view_cell()`` method was called. +No matter which type of View Cell you are using, you can call it from any view by using the ``view_cell()`` helper function. + +The first parameter is the name of the class and method to call, and the second parameter is an array of parameters to pass to the method. :: 'value1', 'param2' => 'value2']) ?> -If you do not include the full namespace for the class, it will assume in can be found in the ``App\Cells`` namespace. So, the following example would attempt to find the ``MyClass`` class in ``app/Cells/MyClass.php``. If it is not found there, all namespaces will be scanned until it is found, searching within a ``Cells`` subdirectory of each namespace. +The Cell method must return a string, which will be inserted into the view where the ``view_cell()`` function was called. + +Namespace Omission +================== + +.. versionadded:: 4.3.0 + +If you do not include the full namespace for the class, it will assume in can be found in the ``App\Cells`` namespace. So, the following example would attempt to find the ``MyClass`` class in **app/Cells/MyClass.php**. If it is not found there, all namespaces will be scanned until it is found, searching within a **Cells** subdirectory of each namespace. :: 'value1', 'param2' => 'value2']) ?> -.. note:: Namespace omission is available since v4.3.0 and later. +Passing Parameters as Key/Value String +====================================== You can also pass the parameters along as a key/value string: :: From 99ae8bdea1d5c870001cac7d6280f7d3f480e322 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 15:16:50 +0900 Subject: [PATCH 125/237] docs: extract source files and fix some bugs --- user_guide_src/source/outgoing/view_cells.rst | 221 +++--------------- .../source/outgoing/view_cells/001.php | 2 + .../source/outgoing/view_cells/002.php | 2 + .../source/outgoing/view_cells/003.php | 2 + .../source/outgoing/view_cells/004.php | 11 + .../source/outgoing/view_cells/005.php | 2 + .../source/outgoing/view_cells/006.php | 2 + .../source/outgoing/view_cells/007.php | 20 ++ .../source/outgoing/view_cells/008.php | 13 ++ .../source/outgoing/view_cells/009.php | 4 + .../source/outgoing/view_cells/010.php | 2 + .../source/outgoing/view_cells/011.php | 13 ++ .../source/outgoing/view_cells/012.php | 16 ++ .../source/outgoing/view_cells/013.php | 2 + .../source/outgoing/view_cells/014.php | 34 +++ .../source/outgoing/view_cells/015.php | 6 + .../source/outgoing/view_cells/016.php | 17 ++ .../source/outgoing/view_cells/017.php | 6 + .../source/outgoing/view_cells/018.php | 15 ++ .../source/outgoing/view_cells/019.php | 22 ++ .../source/outgoing/view_cells/020.php | 2 + .../source/outgoing/view_cells/021.php | 2 + .../source/outgoing/view_cells/022.php | 2 + 23 files changed, 230 insertions(+), 188 deletions(-) create mode 100644 user_guide_src/source/outgoing/view_cells/001.php create mode 100644 user_guide_src/source/outgoing/view_cells/002.php create mode 100644 user_guide_src/source/outgoing/view_cells/003.php create mode 100644 user_guide_src/source/outgoing/view_cells/004.php create mode 100644 user_guide_src/source/outgoing/view_cells/005.php create mode 100644 user_guide_src/source/outgoing/view_cells/006.php create mode 100644 user_guide_src/source/outgoing/view_cells/007.php create mode 100644 user_guide_src/source/outgoing/view_cells/008.php create mode 100644 user_guide_src/source/outgoing/view_cells/009.php create mode 100644 user_guide_src/source/outgoing/view_cells/010.php create mode 100644 user_guide_src/source/outgoing/view_cells/011.php create mode 100644 user_guide_src/source/outgoing/view_cells/012.php create mode 100644 user_guide_src/source/outgoing/view_cells/013.php create mode 100644 user_guide_src/source/outgoing/view_cells/014.php create mode 100644 user_guide_src/source/outgoing/view_cells/015.php create mode 100644 user_guide_src/source/outgoing/view_cells/016.php create mode 100644 user_guide_src/source/outgoing/view_cells/017.php create mode 100644 user_guide_src/source/outgoing/view_cells/018.php create mode 100644 user_guide_src/source/outgoing/view_cells/019.php create mode 100644 user_guide_src/source/outgoing/view_cells/020.php create mode 100644 user_guide_src/source/outgoing/view_cells/021.php create mode 100644 user_guide_src/source/outgoing/view_cells/022.php diff --git a/user_guide_src/source/outgoing/view_cells.rst b/user_guide_src/source/outgoing/view_cells.rst index cad0d3e392a4..b26213459796 100644 --- a/user_guide_src/source/outgoing/view_cells.rst +++ b/user_guide_src/source/outgoing/view_cells.rst @@ -18,10 +18,9 @@ Calling a View Cell No matter which type of View Cell you are using, you can call it from any view by using the ``view_cell()`` helper function. -The first parameter is the name of the class and method to call, and the second parameter is an array of parameters to pass to the method. -:: +The first parameter is the name of the class and method to call, and the second parameter is an array of parameters to pass to the method: - 'value1', 'param2' => 'value2']) ?> +.. literalinclude:: view_cells/001.php The Cell method must return a string, which will be inserted into the view where the ``view_cell()`` function was called. @@ -30,57 +29,35 @@ Namespace Omission .. versionadded:: 4.3.0 -If you do not include the full namespace for the class, it will assume in can be found in the ``App\Cells`` namespace. So, the following example would attempt to find the ``MyClass`` class in **app/Cells/MyClass.php**. If it is not found there, all namespaces will be scanned until it is found, searching within a **Cells** subdirectory of each namespace. -:: +If you do not include the full namespace for the class, it will assume in can be found in the ``App\Cells`` namespace. So, the following example would attempt to find the ``MyClass`` class in **app/Cells/MyClass.php**. If it is not found there, all namespaces will be scanned until it is found, searching within a **Cells** subdirectory of each namespace: - 'value1', 'param2' => 'value2']) ?> +.. literalinclude:: view_cells/002.php Passing Parameters as Key/Value String ====================================== You can also pass the parameters along as a key/value string: -:: - +.. literalinclude:: view_cells/003.php ************ Simple Cells ************ Simple Cells are classes that return a string from the chosen method. An example of a simple Alert Message cell might look like this: -:: - - namespace App\Cells; - class AlertMessage - { - public function show(array $params): string - { - return "
{$params['message']}
"; - } - } +.. literalinclude:: view_cells/004.php You would call it from within a view like: -:: - 'success', 'message' => 'The user has been updated.']) ?> +.. literalinclude:: view_cells/005.php Additionally, you can use parameter names that match the parameter variables in the method for better readability. -When you use it this way, all of the parameters must always be specified in the view cell call:: - - // In a View. - +When you use it this way, all of the parameters must always be specified in the view cell call: - // In a Cell. - public function recentPosts(string $category, int $limit) - { - $posts = $this->blogModel->where('category', $category) - ->orderBy('published_on', 'desc') - ->limit($limit) - ->get(); +.. literalinclude:: view_cells/006.php - return view('recentPosts', ['posts' => $posts]); - } +.. literalinclude:: view_cells/007.php .. _controlled-cells: @@ -103,26 +80,12 @@ Creating a Controlled Cell ========================== At the most basic level, all you need to implement within the class are public properties. These properties will be made available to the view file automatically. Implementing the AlertMessage from above as a Controlled Cell would look like this: -:: - - // app/Cells/AlertMessageCell.php - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; - class AlertMessageCell extends Cell - { - public $type; - public $message; - } +.. literalinclude:: view_cells/008.php - // app/Cells/alert_message.php -
- -
+.. literalinclude:: view_cells/009.php - // Called in main View: - +.. literalinclude:: view_cells/010.php .. _generating-cell-via-command: @@ -138,90 +101,27 @@ You can also create a controlled cell via a built in command from the CLI. The c Using a Different View ====================== -You can specify a custom view name by setting the ``view`` property in the class. The view will be located like any view would be normally. +You can specify a custom view name by setting the ``view`` property in the class. The view will be located like any view would be normally: -:: - - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; - - class AlertMessageCell extends Cell - { - public $type; - public $message; - - protected $view = 'my/custom/view'; - } +.. literalinclude:: view_cells/011.php Customize the Rendering ======================= -If you need more control over the rendering of the HTML, you can implement a ``render()`` method. This method allows you to perform additional logic and pass extra data the view, if needed. The ``render()`` method must return a string. To take advantage of the full features of controlled Cells, you should use ``$this->view()`` instead of the normal ``view()`` helper function. -:: - - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; +If you need more control over the rendering of the HTML, you can implement a ``render()`` method. This method allows you to perform additional logic and pass extra data the view, if needed. The ``render()`` method must return a string. To take advantage of the full features of controlled Cells, you should use ``$this->view()`` instead of the normal ``view()`` helper function: - class AlertMessageCell extends Cell - { - public $type; - public $message; - - public function render(): string - { - return $this->view('my/custom/view', ['extra' => 'data']); - } - } +.. literalinclude:: view_cells/012.php Computed Properties =================== -If you need to perform additional logic for one or more properties you can use computed properties. These require setting the property to either ``protected`` or ``private`` and implementing a public method whose name consists of the property name surrounded by ``get`` and ``Property``. -:: - - // In a View. Initialize the protected properties. - view_cell('AlertMessageCell', ['type' => 'note', 'message' => 'test']); - - // app/Cells/AlertMessageCell.php - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; - - class AlertMessageCell extends Cell - { - protected $type; - protected $message; - private $computed; - - public function mount() - { - $this->computed = sprintf('%s - %s', $this->type, $this->message); - } +If you need to perform additional logic for one or more properties you can use computed properties. These require setting the property to either ``protected`` or ``private`` and implementing a public method whose name consists of the property name surrounded by ``get`` and ``Property``: - public function getComputedProperty(): string - { - return $this->computed; - } +.. literalinclude:: view_cells/013.php - public function getTypeProperty(): string - { - return $this->type; - } +.. literalinclude:: view_cells/014.php - public function getMessageProperty(): string - { - return $this->message; - } - } - - // app/Cells/alert_message.php -
-

type -

-

message -

-

computed:

-
+.. literalinclude:: view_cells/015.php .. important:: You can't set properties that are declared as private during cell initialization. @@ -229,90 +129,35 @@ If you need to perform additional logic for one or more properties you can use c Presentation Methods ==================== -Sometimes you need to perform additional logic for the view, but you don't want to pass it as a parameter. You can implement a method that will be called from within the cell's view itself. This can help the readability of your views. -:: - - // app/Cells/RecentPostsCell.php - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; - - class RecentPostsCell extends Cell - { - protected $posts; +Sometimes you need to perform additional logic for the view, but you don't want to pass it as a parameter. You can implement a method that will be called from within the cell's view itself. This can help the readability of your views: - public function linkPost($post) - { - return anchor('posts/' . $post->id, $post->title); - } - } +.. literalinclude:: view_cells/016.php - // app/Cells/recent_posts.php -
    - -
  • linkPost($post) ?>
  • - -
+.. literalinclude:: view_cells/017.php Performing Setup Logic ====================== -If you need to perform additional logic before the view is rendered, you can implement a ``mount()`` method. This method will be called just after the class is instantiated, and can be used to set additional properties or perform other logic. +If you need to perform additional logic before the view is rendered, you can implement a ``mount()`` method. This method will be called just after the class is instantiated, and can be used to set additional properties or perform other logic: -:: - - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; - - class RecentPostsCell extends Cell - { - protected $posts; - - public function mount() - { - $this->posts = model('PostModel')->getRecent(); - } - } +.. literalinclude:: view_cells/018.php -You can pass additional parameters to the ``mount()`` method by passing them as an array to the ``view_cell()`` helper function. Any of the parameters sent that match a parameter name of the ``mount`` method will be passed in. -:: - - // app/Cells/RecentPostsCell.php - namespace App\Cells; - - use CodeIgniter\View\Cells\Cell; +You can pass additional parameters to the ``mount()`` method by passing them as an array to the ``view_cell()`` helper function. Any of the parameters sent that match a parameter name of the ``mount`` method will be passed in: - class RecentPostsCell extends Cell - { - protected $posts; +.. literalinclude:: view_cells/019.php - public function mount(?int $categoryId) - { - $this->posts = model('PostModel') - ->when($categoryId, function ($query, $category) { - return $query->where('category_id', $categoryId); - }) - ->getRecent(); - } - } - - // Called in main View: - 5]) ?> +.. literalinclude:: view_cells/020.php ************ Cell Caching ************ You can cache the results of the view cell call by passing the number of seconds to cache the data for as the -third parameter. This will use the currently configured cache engine. -:: +third parameter. This will use the currently configured cache engine: - // Cache the view for 5 minutes - +.. literalinclude:: view_cells/021.php You can provide a custom name to use instead of the auto-generated one if you like, by passing the new name -as the fourth parameter:: +as the fourth parameter: - // Cache the view for 5 minutes - +.. literalinclude:: view_cells/022.php diff --git a/user_guide_src/source/outgoing/view_cells/001.php b/user_guide_src/source/outgoing/view_cells/001.php new file mode 100644 index 000000000000..2a9e4361796e --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/001.php @@ -0,0 +1,2 @@ +// In a View. + 'value1', 'param2' => 'value2']) ?> diff --git a/user_guide_src/source/outgoing/view_cells/002.php b/user_guide_src/source/outgoing/view_cells/002.php new file mode 100644 index 000000000000..1dcea35569f2 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/002.php @@ -0,0 +1,2 @@ +// In a View. + 'value1', 'param2' => 'value2']) ?> diff --git a/user_guide_src/source/outgoing/view_cells/003.php b/user_guide_src/source/outgoing/view_cells/003.php new file mode 100644 index 000000000000..93fa8eea5e19 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/003.php @@ -0,0 +1,2 @@ +// In a View. + diff --git a/user_guide_src/source/outgoing/view_cells/004.php b/user_guide_src/source/outgoing/view_cells/004.php new file mode 100644 index 000000000000..26009d86a8eb --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/004.php @@ -0,0 +1,11 @@ +{$params['message']}"; + } +} diff --git a/user_guide_src/source/outgoing/view_cells/005.php b/user_guide_src/source/outgoing/view_cells/005.php new file mode 100644 index 000000000000..776b26573251 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/005.php @@ -0,0 +1,2 @@ +// In a View. + 'success', 'message' => 'The user has been updated.']) ?> diff --git a/user_guide_src/source/outgoing/view_cells/006.php b/user_guide_src/source/outgoing/view_cells/006.php new file mode 100644 index 000000000000..64157d309b12 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/006.php @@ -0,0 +1,2 @@ +// In a View. + diff --git a/user_guide_src/source/outgoing/view_cells/007.php b/user_guide_src/source/outgoing/view_cells/007.php new file mode 100644 index 000000000000..ab1e56b3c5e8 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/007.php @@ -0,0 +1,20 @@ +blogModel->where('category', $category) + ->orderBy('published_on', 'desc') + ->limit($limit) + ->get(); + + return view('recentPosts', ['posts' => $posts]); + } +} diff --git a/user_guide_src/source/outgoing/view_cells/008.php b/user_guide_src/source/outgoing/view_cells/008.php new file mode 100644 index 000000000000..f8b8c68ea8f2 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/008.php @@ -0,0 +1,13 @@ +"> + + diff --git a/user_guide_src/source/outgoing/view_cells/010.php b/user_guide_src/source/outgoing/view_cells/010.php new file mode 100644 index 000000000000..3fdcbd9d18c1 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/010.php @@ -0,0 +1,2 @@ +// Called in main View: + diff --git a/user_guide_src/source/outgoing/view_cells/011.php b/user_guide_src/source/outgoing/view_cells/011.php new file mode 100644 index 000000000000..75f37da190db --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/011.php @@ -0,0 +1,13 @@ +view('my/custom/view', ['extra' => 'data']); + } +} diff --git a/user_guide_src/source/outgoing/view_cells/013.php b/user_guide_src/source/outgoing/view_cells/013.php new file mode 100644 index 000000000000..32e02a03dce6 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/013.php @@ -0,0 +1,2 @@ +// In a View. Initialize the protected properties. + 'note', 'message' => 'test']) ?> diff --git a/user_guide_src/source/outgoing/view_cells/014.php b/user_guide_src/source/outgoing/view_cells/014.php new file mode 100644 index 000000000000..29378e1199ab --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/014.php @@ -0,0 +1,34 @@ +computed = sprintf('%s - %s', $this->type, $this->message); + } + + public function getComputedProperty(): string + { + return $this->computed; + } + + public function getTypeProperty(): string + { + return $this->type; + } + + public function getMessageProperty(): string + { + return $this->message; + } +} diff --git a/user_guide_src/source/outgoing/view_cells/015.php b/user_guide_src/source/outgoing/view_cells/015.php new file mode 100644 index 000000000000..382152cfb105 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/015.php @@ -0,0 +1,6 @@ +// app/Cells/alert_message.php +
+

type -

+

message -

+

computed:

+
diff --git a/user_guide_src/source/outgoing/view_cells/016.php b/user_guide_src/source/outgoing/view_cells/016.php new file mode 100644 index 000000000000..4b2c10ef0cc6 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/016.php @@ -0,0 +1,17 @@ +id, $post->title); + } +} diff --git a/user_guide_src/source/outgoing/view_cells/017.php b/user_guide_src/source/outgoing/view_cells/017.php new file mode 100644 index 000000000000..359eb6fce035 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/017.php @@ -0,0 +1,6 @@ +// app/Cells/recent_posts.php +
    + +
  • linkPost($post) ?>
  • + +
diff --git a/user_guide_src/source/outgoing/view_cells/018.php b/user_guide_src/source/outgoing/view_cells/018.php new file mode 100644 index 000000000000..8fc2a4c5b6ae --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/018.php @@ -0,0 +1,15 @@ +posts = model('PostModel')->getRecent(); + } +} diff --git a/user_guide_src/source/outgoing/view_cells/019.php b/user_guide_src/source/outgoing/view_cells/019.php new file mode 100644 index 000000000000..2ed71e348e29 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/019.php @@ -0,0 +1,22 @@ +posts = model('PostModel') + ->when( + $categoryId, + static fn ($query, $categoryId) => $query->where('category_id', $categoryId) + ) + ->getRecent(); + } +} diff --git a/user_guide_src/source/outgoing/view_cells/020.php b/user_guide_src/source/outgoing/view_cells/020.php new file mode 100644 index 000000000000..55d6788211d6 --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/020.php @@ -0,0 +1,2 @@ +// Called in main View: + 5]) ?> diff --git a/user_guide_src/source/outgoing/view_cells/021.php b/user_guide_src/source/outgoing/view_cells/021.php new file mode 100644 index 000000000000..a6b814d1f9cb --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/021.php @@ -0,0 +1,2 @@ +// Cache the view for 5 minutes + diff --git a/user_guide_src/source/outgoing/view_cells/022.php b/user_guide_src/source/outgoing/view_cells/022.php new file mode 100644 index 000000000000..8c588695719f --- /dev/null +++ b/user_guide_src/source/outgoing/view_cells/022.php @@ -0,0 +1,2 @@ +// Cache the view for 5 minutes + From 1a547723fc9a962f82082a4f42015d76d2bbc728 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 15:29:55 +0900 Subject: [PATCH 126/237] docs: add () after method name --- user_guide_src/source/outgoing/view_cells.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_cells.rst b/user_guide_src/source/outgoing/view_cells.rst index b26213459796..91b22fadb639 100644 --- a/user_guide_src/source/outgoing/view_cells.rst +++ b/user_guide_src/source/outgoing/view_cells.rst @@ -142,7 +142,7 @@ If you need to perform additional logic before the view is rendered, you can imp .. literalinclude:: view_cells/018.php -You can pass additional parameters to the ``mount()`` method by passing them as an array to the ``view_cell()`` helper function. Any of the parameters sent that match a parameter name of the ``mount`` method will be passed in: +You can pass additional parameters to the ``mount()`` method by passing them as an array to the ``view_cell()`` helper function. Any of the parameters sent that match a parameter name of the ``mount()`` method will be passed in: .. literalinclude:: view_cells/019.php From 6d13ca95d79ee0deabd6c70ac0f73f3b6bc35316 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 14:23:01 +0900 Subject: [PATCH 127/237] docs: add @param --- system/View/Cell.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/View/Cell.php b/system/View/Cell.php index b898adc0e754..ddb2941b5f44 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -64,7 +64,10 @@ public function __construct(CacheInterface $cache) /** * Render a cell, returning its body as a string. * - * @param array|string|null $params + * @param string $library Cell class and method name. + * @param array|string|null $params Parameters to pass to the method. + * @param int $ttl Number of seconds to cache the cell. + * @param string|null $cacheName Cache item name. * * @throws ReflectionException */ From 6e0a9a506c7c829e7f03f33a6d2995c55c8221b0 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 6 Jul 2023 17:39:21 +0800 Subject: [PATCH 128/237] Remove `SODIUM_LIBRARY_VERSION` from `dynamicConstantNames` --- phpstan.neon.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c6d69a55dbe2..751c67ca23f1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -44,4 +44,3 @@ parameters: - APP_NAMESPACE - CI_DEBUG - ENVIRONMENT - - SODIUM_LIBRARY_VERSION From e5cfd4e27798629d85f6e29c4513ab2a477f9189 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 6 Jul 2023 17:48:47 +0800 Subject: [PATCH 129/237] Remove `parallel.processTimeout` --- phpstan.neon.dist | 2 -- 1 file changed, 2 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c6d69a55dbe2..d8c90f3bf1da 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -36,8 +36,6 @@ parameters: - system/Test/Filters/CITestStreamFilter.php - system/ThirdParty/* - system/Validation/Views/single.php - parallel: - processTimeout: 300.0 scanDirectories: - system/Helpers dynamicConstantNames: From f61b41da51565aab9b1e7e1cdef0b0476e1fdab1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 16:03:00 +0900 Subject: [PATCH 130/237] fix: normailze params If you call view_cell() with param ['param1' => 'value1'], and call with param 'param1=value1', they should be one cache. --- system/View/Cell.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/View/Cell.php b/system/View/Cell.php index ddb2941b5f44..5d575bced1e7 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -79,6 +79,8 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c ? get_class($instance) : null; + $params = $this->prepareParams($params); + // Is the output cached? $cacheName = ! empty($cacheName) ? $cacheName @@ -96,8 +98,6 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c throw ViewException::forInvalidCellMethod($class, $method); } - $params = $this->prepareParams($params); - $output = $instance instanceof BaseCell ? $this->renderCell($instance, $method, $params) : $this->renderSimpleClass($instance, $method, $params, $class); From 8133881ea1b8d1c762064005b7fdf317f3e7ad7f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 7 Jul 2023 04:11:24 +0700 Subject: [PATCH 131/237] [Rector] Remove NodeConnectingVisitor from phsptan config --- phpstan.neon.dist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 884a3dc91bfa..b196b90397f5 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,7 +1,3 @@ -conditionalTags: - PhpParser\NodeVisitor\NodeConnectingVisitor: - phpstan.parser.richParserNodeVisitor: true - services: - class: Utils\PHPStan\CheckUseStatementsAfterLicenseRule From 3d946c8a4c50c732f3c2732ba9abef22b9aaa27e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 7 Jul 2023 04:14:50 +0700 Subject: [PATCH 132/237] change neon file should run rector as well --- .github/workflows/test-rector.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-rector.yml b/.github/workflows/test-rector.yml index 89f211120d0d..7df4a3a3d3ed 100644 --- a/.github/workflows/test-rector.yml +++ b/.github/workflows/test-rector.yml @@ -15,6 +15,7 @@ on: - '.github/workflows/test-rector.yml' - composer.json - rector.php + - '**.neon.dist' push: branches: @@ -28,6 +29,7 @@ on: - '.github/workflows/test-rector.yml' - composer.json - rector.php + - '**.neon.dist' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From 39406f0972d02a0a9fd2e5e707b0649799f68173 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 11:52:32 +0900 Subject: [PATCH 133/237] docs: add max_length to sample code It is good practice to check max length. --- user_guide_src/source/libraries/validation/002.php | 8 ++++---- user_guide_src/source/libraries/validation/005.php | 4 ++-- user_guide_src/source/libraries/validation/006.php | 8 ++++---- user_guide_src/source/libraries/validation/007.php | 8 ++++---- user_guide_src/source/libraries/validation/009.php | 4 ++-- user_guide_src/source/libraries/validation/010.php | 2 +- user_guide_src/source/libraries/validation/011.php | 2 +- user_guide_src/source/libraries/validation/013.php | 8 ++++---- user_guide_src/source/libraries/validation/015.php | 8 ++++---- user_guide_src/source/libraries/validation/016.php | 4 ++-- user_guide_src/source/libraries/validation/020.php | 4 ++-- user_guide_src/source/libraries/validation/022.php | 4 ++-- user_guide_src/source/libraries/validation/023.php | 4 ++-- user_guide_src/source/libraries/validation/024.php | 4 ++-- user_guide_src/source/libraries/validation/025.php | 4 ++-- user_guide_src/source/libraries/validation/036.php | 2 +- user_guide_src/source/libraries/validation/038.php | 8 ++++---- 17 files changed, 43 insertions(+), 43 deletions(-) diff --git a/user_guide_src/source/libraries/validation/002.php b/user_guide_src/source/libraries/validation/002.php index d1eeff19c329..b8d5811f356d 100644 --- a/user_guide_src/source/libraries/validation/002.php +++ b/user_guide_src/source/libraries/validation/002.php @@ -3,10 +3,10 @@ // ... $rules = [ - 'username' => 'required', - 'password' => 'required|min_length[10]', - 'passconf' => 'required|matches[password]', - 'email' => 'required|valid_email', + 'username' => 'required|max_length[30]', + 'password' => 'required|max_length[255]|min_length[10]', + 'passconf' => 'required|max_length[255]|matches[password]', + 'email' => 'required|max_length[254]|valid_email', ]; // ... diff --git a/user_guide_src/source/libraries/validation/005.php b/user_guide_src/source/libraries/validation/005.php index 9d129e6425e1..6ab43932d769 100644 --- a/user_guide_src/source/libraries/validation/005.php +++ b/user_guide_src/source/libraries/validation/005.php @@ -1,4 +1,4 @@ setRule('username', 'Username', 'required|min_length[3]'); -$validation->setRule('password', 'Password', ['required', 'min_length[8]', 'alpha_numeric_punct']); +$validation->setRule('username', 'Username', 'required|max_length[30]|min_length[3]'); +$validation->setRule('password', 'Password', ['required', 'max_length[255]', 'min_length[8]', 'alpha_numeric_punct']); diff --git a/user_guide_src/source/libraries/validation/006.php b/user_guide_src/source/libraries/validation/006.php index 5f7cbf645ab2..bd4dbf10c787 100644 --- a/user_guide_src/source/libraries/validation/006.php +++ b/user_guide_src/source/libraries/validation/006.php @@ -1,11 +1,11 @@ setRules([ - 'username' => 'required', - 'password' => 'required|min_length[10]', + 'username' => 'required|max_length[30]', + 'password' => 'required|max_length[255]|min_length[10]', ]); // or $validation->setRules([ - 'username' => 'required', - 'password' => ['required', 'min_length[10]'], + 'username' => ['required', 'max_length[30]'], + 'password' => ['required', 'max_length[255]', 'min_length[10]'], ]); diff --git a/user_guide_src/source/libraries/validation/007.php b/user_guide_src/source/libraries/validation/007.php index cb12c5a61a79..b5f23c355a5c 100644 --- a/user_guide_src/source/libraries/validation/007.php +++ b/user_guide_src/source/libraries/validation/007.php @@ -1,11 +1,11 @@ setRules([ - 'username' => ['label' => 'Username', 'rules' => 'required'], - 'password' => ['label' => 'Password', 'rules' => 'required|min_length[10]'], + 'username' => ['label' => 'Username', 'rules' => 'required|max_length[30]'], + 'password' => ['label' => 'Password', 'rules' => 'required|max_length[255]|min_length[10]'], ]); // or $validation->setRules([ - 'username' => ['label' => 'Username', 'rules' => 'required'], - 'password' => ['label' => 'Password', 'rules' => ['required', 'min_length[10]']], + 'username' => ['label' => 'Username', 'rules' => 'required|max_length[30]'], + 'password' => ['label' => 'Password', 'rules' => ['required', '|max_length[255]', 'min_length[10]']], ]); diff --git a/user_guide_src/source/libraries/validation/009.php b/user_guide_src/source/libraries/validation/009.php index 58f0749a0c5d..7e321e9664ff 100644 --- a/user_guide_src/source/libraries/validation/009.php +++ b/user_guide_src/source/libraries/validation/009.php @@ -19,10 +19,10 @@ // Joe Smith $validation->setRules([ - 'contacts.name' => 'required', + 'contacts.name' => 'required|max_length[60]', ]); // Fred Flintsone & Wilma $validation->setRules([ - 'contacts.friends.name' => 'required', + 'contacts.friends.name' => 'required|max_length[60]', ]); diff --git a/user_guide_src/source/libraries/validation/010.php b/user_guide_src/source/libraries/validation/010.php index 94c6919311d5..0951f582c882 100644 --- a/user_guide_src/source/libraries/validation/010.php +++ b/user_guide_src/source/libraries/validation/010.php @@ -2,5 +2,5 @@ // Fred Flintsone & Wilma $validation->setRules([ - 'contacts.*.name' => 'required', + 'contacts.*.name' => 'required|max_length[60]', ]); diff --git a/user_guide_src/source/libraries/validation/011.php b/user_guide_src/source/libraries/validation/011.php index 2754c41ac933..9b5e03eb4948 100644 --- a/user_guide_src/source/libraries/validation/011.php +++ b/user_guide_src/source/libraries/validation/011.php @@ -13,5 +13,5 @@ // Rule $validation->setRules([ - 'user_ids.*' => 'required', + 'user_ids.*' => 'required|max_length[19]', ]); diff --git a/user_guide_src/source/libraries/validation/013.php b/user_guide_src/source/libraries/validation/013.php index 671b5386fe98..383eb8153574 100644 --- a/user_guide_src/source/libraries/validation/013.php +++ b/user_guide_src/source/libraries/validation/013.php @@ -5,10 +5,10 @@ class Validation { public $signup = [ - 'username' => 'required', - 'password' => 'required', - 'pass_confirm' => 'required|matches[password]', - 'email' => 'required|valid_email', + 'username' => 'required|max_length[30]', + 'password' => 'required|max_length[255]', + 'pass_confirm' => 'required|max_length[255]|matches[password]', + 'email' => 'required|max_length[254]|valid_email', ]; // ... diff --git a/user_guide_src/source/libraries/validation/015.php b/user_guide_src/source/libraries/validation/015.php index 5815abfaccf4..91f9ac1c1c31 100644 --- a/user_guide_src/source/libraries/validation/015.php +++ b/user_guide_src/source/libraries/validation/015.php @@ -5,10 +5,10 @@ class Validation { public $signup = [ - 'username' => 'required', - 'password' => 'required', - 'pass_confirm' => 'required|matches[password]', - 'email' => 'required|valid_email', + 'username' => 'required|max_length[30]', + 'password' => 'required|max_length[255]', + 'pass_confirm' => 'required|max_length[255]|matches[password]', + 'email' => 'required|max_length[254]|valid_email', ]; public $signup_errors = [ diff --git a/user_guide_src/source/libraries/validation/016.php b/user_guide_src/source/libraries/validation/016.php index 5b08e73980a8..c11237a9cf09 100644 --- a/user_guide_src/source/libraries/validation/016.php +++ b/user_guide_src/source/libraries/validation/016.php @@ -6,13 +6,13 @@ class Validation { public $signup = [ 'username' => [ - 'rules' => 'required', + 'rules' => 'required|max_length[30]', 'errors' => [ 'required' => 'You must choose a Username.', ], ], 'email' => [ - 'rules' => 'required|valid_email', + 'rules' => 'required|max_length[254]|valid_email', 'errors' => [ 'valid_email' => 'Please check the Email field. It does not appear to be valid.', ], diff --git a/user_guide_src/source/libraries/validation/020.php b/user_guide_src/source/libraries/validation/020.php index 67fdb567eda3..792b7ba6bbe9 100644 --- a/user_guide_src/source/libraries/validation/020.php +++ b/user_guide_src/source/libraries/validation/020.php @@ -1,6 +1,6 @@ setRules([ - 'id' => 'is_natural_no_zero', - 'email' => 'required|valid_email|is_unique[users.email,id,{id}]', + 'id' => 'max_length[19]|is_natural_no_zero', + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,{id}]', ]); diff --git a/user_guide_src/source/libraries/validation/022.php b/user_guide_src/source/libraries/validation/022.php index 001c0f0d76a7..f3dda9e966df 100644 --- a/user_guide_src/source/libraries/validation/022.php +++ b/user_guide_src/source/libraries/validation/022.php @@ -1,6 +1,6 @@ setRules([ - 'id' => 'is_natural_no_zero', - 'email' => 'required|valid_email|is_unique[users.email,id,4]', + 'id' => 'max_length[19]|is_natural_no_zero', + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,4]', ]); diff --git a/user_guide_src/source/libraries/validation/023.php b/user_guide_src/source/libraries/validation/023.php index f9ba86d1f60c..85fd02e5b8c7 100644 --- a/user_guide_src/source/libraries/validation/023.php +++ b/user_guide_src/source/libraries/validation/023.php @@ -2,8 +2,8 @@ $validation->setRules( [ - 'username' => 'required|is_unique[users.username]', - 'password' => 'required|min_length[10]', + 'username' => 'required|max_length[30]|is_unique[users.username]', + 'password' => 'required|max_length[254]|min_length[10]', ], [ // Errors 'username' => [ diff --git a/user_guide_src/source/libraries/validation/024.php b/user_guide_src/source/libraries/validation/024.php index 17f053ee41a4..a8fb8151d6d4 100644 --- a/user_guide_src/source/libraries/validation/024.php +++ b/user_guide_src/source/libraries/validation/024.php @@ -3,14 +3,14 @@ $validation->setRules([ 'username' => [ 'label' => 'Username', - 'rules' => 'required|is_unique[users.username]', + 'rules' => 'required|max_length[30]|is_unique[users.username]', 'errors' => [ 'required' => 'All accounts must have {field} provided', ], ], 'password' => [ 'label' => 'Password', - 'rules' => 'required|min_length[10]', + 'rules' => 'required|max_length[255]|min_length[10]', 'errors' => [ 'min_length' => 'Your {field} is too short. You want to get hacked?', ], diff --git a/user_guide_src/source/libraries/validation/025.php b/user_guide_src/source/libraries/validation/025.php index 6e2f1e40843b..60f53893edce 100644 --- a/user_guide_src/source/libraries/validation/025.php +++ b/user_guide_src/source/libraries/validation/025.php @@ -3,14 +3,14 @@ $validation->setRules([ 'username' => [ 'label' => 'Rules.username', - 'rules' => 'required|is_unique[users.username]', + 'rules' => 'required|max_length[30]|is_unique[users.username]', 'errors' => [ 'required' => 'Rules.username.required', ], ], 'password' => [ 'label' => 'Rules.password', - 'rules' => 'required|min_length[10]', + 'rules' => 'required|max_length[255]|min_length[10]', 'errors' => [ 'min_length' => 'Rules.password.min_length', ], diff --git a/user_guide_src/source/libraries/validation/036.php b/user_guide_src/source/libraries/validation/036.php index 2cc83471edfd..66919dadf4a9 100644 --- a/user_guide_src/source/libraries/validation/036.php +++ b/user_guide_src/source/libraries/validation/036.php @@ -1,5 +1,5 @@ setRules([ - 'foo' => 'required|even', + 'foo' => 'required|max_length[19]|even', ]); diff --git a/user_guide_src/source/libraries/validation/038.php b/user_guide_src/source/libraries/validation/038.php index f4ec3371527f..538a7f724dd3 100644 --- a/user_guide_src/source/libraries/validation/038.php +++ b/user_guide_src/source/libraries/validation/038.php @@ -3,10 +3,10 @@ // is_unique[table.field,ignore_field,ignore_value] $validation->setRules([ - 'name' => "is_unique[supplier.name,uuid, {$uuid}]", // is not ok - 'name' => "is_unique[supplier.name,uuid,{$uuid} ]", // is not ok - 'name' => "is_unique[supplier.name,uuid,{$uuid}]", // is ok - 'name' => 'is_unique[supplier.name,uuid,{uuid}]', // is ok - see "Validation Placeholders" + 'name' => "max_length[30]|is_unique[supplier.name,uuid, {$uuid}]", // is not ok + 'name' => "max_length[30]|is_unique[supplier.name,uuid,{$uuid} ]", // is not ok + 'name' => "max_length[30]|is_unique[supplier.name,uuid,{$uuid}]", // is ok + 'name' => 'max_length[30]|is_unique[supplier.name,uuid,{uuid}]', // is ok - see "Validation Placeholders" ]); // Warning: If `$uuid` is a user input, be sure to validate the format of the value before using it. // Otherwise, it is vulnerable. From 9cefb0ed624e0fbd74cc526dd2fdf9bb46a0569f Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 11:58:23 +0900 Subject: [PATCH 134/237] docs: improve upgrade instruction for validation placeholder --- .../source/installation/upgrade_435.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/upgrade_435.rst b/user_guide_src/source/installation/upgrade_435.rst index 06d055a03fa4..347bb035befc 100644 --- a/user_guide_src/source/installation/upgrade_435.rst +++ b/user_guide_src/source/installation/upgrade_435.rst @@ -18,7 +18,20 @@ Breaking Changes Validation Placeholders ======================= -- To use :ref:`validation-placeholders` securely, please remember to create a validation rule for the field you will use as a placeholder. +To use :ref:`validation-placeholders` securely, please remember to create a validation rule for the field you will use as a placeholder. + +E.g., if you have the following code:: + + $validation->setRules([ + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,{id}]', + ]); + +You need to add the rules for ``{id}``:: + + $validation->setRules([ + 'id' => 'max_length[19]|is_natural_no_zero', // Add this + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,{id}]', + ]); Session::stop() =============== From c875d33631a5549f04a68137207a352dacfec199 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 14:09:42 +0900 Subject: [PATCH 135/237] docs: improve descriptions in Factories --- user_guide_src/source/concepts/factories.rst | 28 +++++++++---------- .../source/concepts/factories/002.php | 2 ++ .../source/general/common_functions.rst | 2 +- user_guide_src/source/general/modules.rst | 4 +-- user_guide_src/source/models/model.rst | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/user_guide_src/source/concepts/factories.rst b/user_guide_src/source/concepts/factories.rst index c09134a47b54..c043bb6428b0 100644 --- a/user_guide_src/source/concepts/factories.rst +++ b/user_guide_src/source/concepts/factories.rst @@ -4,7 +4,7 @@ Factories .. contents:: :local: - :depth: 2 + :depth: 3 Introduction ************ @@ -41,17 +41,14 @@ On the other hand, Services have code to create instances, so it can create a co that needs other services or class instances. When you get a service, Services require a service name, not a class name, so the returned instance can be changed without changing the client code. +.. _factories-loading-class: + Loading Classes *************** Loading a Class =============== -.. _factories-example: - -Model Example -------------- - Take a look at **Models** as an example. You can access the Factory specific to Models by using the magic static method of the Factories class, ``Factories::models()``. @@ -64,7 +61,17 @@ In the following code, if you have ``App\Models\UserModel``, the instance will b .. literalinclude:: factories/001.php -Or you could also request a specific class: +If you don't have ``App\Models\UserModel``, it searches for ``Models\UserModel`` in all namespaces. + +Next time you ask for the same class anywhere in your code, Factories will be sure +you get back the instance as before: + +.. literalinclude:: factories/003.php + +preferApp option +---------------- + +You could also request a specific class: .. literalinclude:: factories/002.php :lines: 2- @@ -78,13 +85,6 @@ If you want to get ``Blog\Models\UserModel``, you need to disable the option ``p .. literalinclude:: factories/010.php :lines: 2- -See :ref:`factories-options` for the details. - -Next time you ask for the same class anywhere in your code, Factories will be sure -you get back the instance as before: - -.. literalinclude:: factories/003.php - Loading a Class in Sub-directories ================================== diff --git a/user_guide_src/source/concepts/factories/002.php b/user_guide_src/source/concepts/factories/002.php index 6a56bbe7a374..6de5996e74af 100644 --- a/user_guide_src/source/concepts/factories/002.php +++ b/user_guide_src/source/concepts/factories/002.php @@ -1,3 +1,5 @@ `. diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 2298c32a986f..5bfbdf7b75d7 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -194,7 +194,7 @@ Config files are automatically discovered whenever using the ``config()`` functi .. note:: ``config()`` finds the file in **app/Config/** when there is a class with the same shortname, even if you specify a fully qualified class name like ``config(\Acme\Blog\Config\Blog::class)``. - This is because ``config()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`Factories Example ` for more information. + This is because ``config()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`factories-loading-class` for more information. Migrations ========== @@ -250,7 +250,7 @@ Model files are automatically discovered whenever using the :php:func:`model()` .. note:: ``model()`` finds the file in **app/Models/** when there is a class with the same shortname, even if you specify a fully qualified class name like ``model(\Acme\Blog\Model\PostModel::class)``. - This is because ``model()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`Factories Example ` for more information. + This is because ``model()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`factories-loading-class` for more information. Views ===== diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 06f7d84f26f2..6fe16326cdd1 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -29,7 +29,7 @@ You can access models within your classes by creating a new instance or using th .. literalinclude:: model/001.php The ``model()`` uses ``Factories::models()`` internally. -See :ref:`factories-example` for details on the first parameter. +See :ref:`factories-loading-class` for details on the first parameter. CodeIgniter's Model ******************* From 1a1d6180eb889afee30cc06d2d1112aac36324bd Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 14:14:51 +0900 Subject: [PATCH 136/237] docs: add section titles and note --- .../source/general/configuration.rst | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index e9a1a7df2cad..a223ad901cb0 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -18,19 +18,24 @@ the application configuration files in the **app/Config** folder. Working with Configuration Files ******************************** +Getting a Config Object +======================= + You can access configuration files for your classes in several different ways. -- By using the ``new`` keyword to create an instance: +new keyword +----------- - .. literalinclude:: configuration/001.php +By using the ``new`` keyword to create an instance: -- By using the ``config()`` function: +.. literalinclude:: configuration/001.php - .. literalinclude:: configuration/002.php +config() +-------- -All configuration object properties are public, so you access the settings like any other property: +By using the ``config()`` function: -.. literalinclude:: configuration/003.php +.. literalinclude:: configuration/002.php If no namespace is provided, it will look for the file in all defined namespaces as well as **app/Config/**. @@ -39,10 +44,16 @@ All of the configuration files that ship with CodeIgniter are namespaced with ``Config``. Using this namespace in your application will provide the best performance since it knows exactly where to find the files. -You can put configuration files in any folder you want by using a different namespace. -This allows you to put configuration files on the production server in a folder -that is not web-accessible while keeping it under **/app** for easy access -during development. +.. note:: ``config()`` finds the file in **app/Config/** when there is a class with the same shortname, + even if you specify a fully qualified class name like ``config(\Acme\Blog\Config\Blog::class)``. + This is because ``config()`` is a wrapper for the ``Factories`` class which uses ``preferApp`` by default. See :ref:`factories-loading-class` for more information. + +Getting a Config Property +========================= + +All configuration object properties are public, so you access the settings like any other property: + +.. literalinclude:: configuration/003.php Creating Configuration Files **************************** @@ -52,6 +63,11 @@ The default file location (recommended for most cases) is **app/Config**. The class should use the appropriate namespace, and it should extend ``CodeIgniter\Config\BaseConfig`` to ensure that it can receive environment-specific settings. +You can put configuration files in any folder you want by using a different namespace. +This allows you to put configuration files on the production server in a folder +that is not web-accessible while keeping it under **/app** for easy access +during development. + Define the class and fill it with public properties that represent your settings: .. literalinclude:: configuration/004.php From 87864bd72b7f04639c324faedfb5d2aaf66e8c16 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 14:24:14 +0900 Subject: [PATCH 137/237] docs: remove unneeded description All source files should be in not web-accessible directories. --- user_guide_src/source/general/configuration.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index a223ad901cb0..9ec7be2c757f 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -60,13 +60,11 @@ Creating Configuration Files When you need a new configuration, first you create a new file at your desired location. The default file location (recommended for most cases) is **app/Config**. -The class should use the appropriate namespace, and it should extend -``CodeIgniter\Config\BaseConfig`` to ensure that it can receive environment-specific settings. You can put configuration files in any folder you want by using a different namespace. -This allows you to put configuration files on the production server in a folder -that is not web-accessible while keeping it under **/app** for easy access -during development. + +The class should use the appropriate namespace, and it should extend +``CodeIgniter\Config\BaseConfig`` to ensure that it can receive environment-specific settings. Define the class and fill it with public properties that represent your settings: From 9084605b2e62d8c54436b4828c28e32706c30da1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 14:30:45 +0900 Subject: [PATCH 138/237] docs: add explanation --- user_guide_src/source/general/configuration.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 9ec7be2c757f..5d4c4a5e8737 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -37,8 +37,9 @@ By using the ``config()`` function: .. literalinclude:: configuration/002.php -If no namespace is provided, it will look for the file in all defined namespaces -as well as **app/Config/**. +If no namespace is provided, it will look for the file in the **app/Config** +folder first, and if not found, look for in the **Config** folder in all defined +namespaces. All of the configuration files that ship with CodeIgniter are namespaced with ``Config``. Using this namespace in your application will provide the best @@ -61,7 +62,7 @@ Creating Configuration Files When you need a new configuration, first you create a new file at your desired location. The default file location (recommended for most cases) is **app/Config**. -You can put configuration files in any folder you want by using a different namespace. +You can put configuration files in any **Config** folder by using a different namespace. The class should use the appropriate namespace, and it should extend ``CodeIgniter\Config\BaseConfig`` to ensure that it can receive environment-specific settings. From 78ff86fafb7fceba30340d4af7d95e4ef48df23e Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 6 Jul 2023 19:07:07 +0800 Subject: [PATCH 139/237] refactor: simplify code of `FileHandler::getItem()` --- phpstan-baseline.neon.dist | 10 ---- system/Cache/Handlers/FileHandler.php | 56 +++++++++---------- .../system/Cache/Handlers/FileHandlerTest.php | 17 +++++- 3 files changed, 39 insertions(+), 44 deletions(-) diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist index c3eaed7ade31..892f28ffa1c6 100644 --- a/phpstan-baseline.neon.dist +++ b/phpstan-baseline.neon.dist @@ -10,16 +10,6 @@ parameters: count: 1 path: system/Autoloader/Autoloader.php - - - message: "#^Comparison operation \"\\>\" between int and \\(array\\|float\\|int\\) results in an error\\.$#" - count: 1 - path: system/Cache/Handlers/FileHandler.php - - - - message: "#^If condition is always true\\.$#" - count: 1 - path: system/Cache/Handlers/FileHandler.php - - message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#" count: 1 diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index c217c7edde8e..9d1179feb82a 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -144,21 +144,22 @@ public function deleteMatching(string $pattern) */ public function increment(string $key, int $offset = 1) { - $key = static::validateKey($key, $this->prefix); - $data = $this->getItem($key); + $key = static::validateKey($key, $this->prefix); + $tmp = $this->getItem($key); - if ($data === false) { - $data = [ - 'data' => 0, - 'ttl' => 60, - ]; - } elseif (! is_int($data['data'])) { + if ($tmp === false) { + $tmp = ['data' => 0, 'ttl' => 60]; + } + + ['data' => $value, 'ttl' => $ttl] = $tmp; + + if (! is_int($value)) { return false; } - $newValue = $data['data'] + $offset; + $value += $offset; - return $this->save($key, $newValue, $data['ttl']) ? $newValue : false; + return $this->save($key, $value, $ttl) ? $value : false; } /** @@ -166,21 +167,7 @@ public function increment(string $key, int $offset = 1) */ public function decrement(string $key, int $offset = 1) { - $key = static::validateKey($key, $this->prefix); - $data = $this->getItem($key); - - if ($data === false) { - $data = [ - 'data' => 0, - 'ttl' => 60, - ]; - } elseif (! is_int($data['data'])) { - return false; - } - - $newValue = $data['data'] - $offset; - - return $this->save($key, $newValue, $data['ttl']) ? $newValue : false; + return $this->increment($key, -$offset); } /** @@ -229,7 +216,8 @@ public function isSupported(): bool * Does the heavy lifting of actually retrieving the file and * verifying it's age. * - * @return array|bool|float|int|object|string|null + * @return array|false + * @phpstan-return array{data: mixed, ttl: int, time: int}|false */ protected function getItem(string $filename) { @@ -238,15 +226,21 @@ protected function getItem(string $filename) } $data = @unserialize(file_get_contents($this->path . $filename)); - if (! is_array($data) || ! isset($data['ttl'])) { + + if (! is_array($data)) { + return false; + } + + if (! isset($data['ttl']) || ! is_int($data['ttl'])) { + return false; + } + + if (! isset($data['time']) || ! is_int($data['time'])) { return false; } if ($data['ttl'] > 0 && Time::now()->getTimestamp() > $data['time'] + $data['ttl']) { - // If the file is still there then try to remove it - if (is_file($this->path . $filename)) { - @unlink($this->path . $filename); - } + @unlink($this->path . $filename); return false; } diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index dde4ca86e13d..4f354495c81a 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -78,6 +78,11 @@ public function testNew() $this->assertInstanceOf(FileHandler::class, $this->handler); } + /** + * chmod('path', 0444) does not work on Windows + * + * @requires OS Linux|Darwin + */ public function testNewWithNonWritablePath() { $this->expectException(CacheException::class); @@ -132,6 +137,11 @@ public function testRemember() $this->assertNull($this->handler->get(self::$key1)); } + /** + * chmod('path', 0444) does not work on Windows + * + * @requires OS Linux|Darwin + */ public function testSave() { $this->assertTrue($this->handler->save(self::$key1, 'value')); @@ -265,10 +275,11 @@ public function testIsSupported() /** * @dataProvider modeProvider * - * @param mixed $int - * @param mixed $string + * permissions given on Windows are fixed to `0666` + * + * @requires OS Linux|Darwin */ - public function testSaveMode($int, $string) + public function testSaveMode(int $int, string $string): void { // Initialize mode $config = new Cache(); From 47990ba74b664bfbcd4748e958215934f13fffa2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 7 Jul 2023 16:21:03 +0700 Subject: [PATCH 140/237] [Rector] Refactor UnderscoreToCamelCaseVariableNameRector as removed findParentByType() --- .../UnderscoreToCamelCaseVariableNameRector.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index 054eb75a2800..31834cfc4e88 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -113,13 +113,16 @@ public function refactor(Node $node): ?Node private function updateDocblock(Variable $variable, string $variableName, string $camelCaseName): void { - $parentClassMethodOrFunction = $this->betterNodeFinder->findParentByTypes($variable, [ClassMethod::class, Function_::class]); + $parentFunctionLike = $this->betterNodeFinder->findParentType($variable, ClassMethod::class); - if ($parentClassMethodOrFunction === null) { - return; + if ($parentFunctionLike === null) { + $parentFunctionLike = $this->betterNodeFinder->findParentType($variable, Function_::class); + if ($parentFunctionLike === null) { + return; + } } - $docComment = $parentClassMethodOrFunction->getDocComment(); + $docComment = $parentFunctionLike->getDocComment(); if ($docComment === null) { return; } @@ -133,7 +136,7 @@ private function updateDocblock(Variable $variable, string $variableName, string return; } - $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($parentClassMethodOrFunction); + $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($parentFunctionLike); $paramTagValueNodes = $phpDocInfo->getParamTagValueNodes(); foreach ($paramTagValueNodes as $paramTagValueNode) { @@ -143,6 +146,6 @@ private function updateDocblock(Variable $variable, string $variableName, string } } - $parentClassMethodOrFunction->setDocComment(new Doc($phpDocInfo->getPhpDocNode()->__toString())); + $parentFunctionLike->setDocComment(new Doc($phpDocInfo->getPhpDocNode()->__toString())); } } From bc408a538a182a867b842ffde7b5aebadbb17e11 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 07:55:45 +0900 Subject: [PATCH 141/237] docs: make option values stand out --- user_guide_src/source/general/common_functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 5d41dde21fab..896c607d9822 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -79,7 +79,7 @@ Service Accessors If $data is a string, then it simply escapes and returns it. If $data is an array, then it loops over it, escaping each 'value' of the key/value pairs. - Valid context values: html, js, css, url, attr, raw + Valid context values: ``html``, ``js``, ``css``, ``url``, ``attr``, ``raw`` .. php:function:: helper($filename) From 36e40508515177a7ee7adddcf6556071cee8c6cd Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 07:56:42 +0900 Subject: [PATCH 142/237] docs: make comment on one line --- user_guide_src/source/general/common_functions/002.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/general/common_functions/002.php b/user_guide_src/source/general/common_functions/002.php index 1ade75d94317..f00b1f816398 100644 --- a/user_guide_src/source/general/common_functions/002.php +++ b/user_guide_src/source/general/common_functions/002.php @@ -2,8 +2,7 @@ // in controller, checking form submittal if (! $model->save($user)) { - // 'withInput' is what specifies "old data" - // should be saved. + // 'withInput()' is what specifies "old data" should be saved. return redirect()->back()->withInput(); } From 6f2969d2484e282066d325f4a17e06adc218fffd Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 07:57:28 +0900 Subject: [PATCH 143/237] docs: fix types in reference --- 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 896c607d9822..c8f17f09746c 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -117,10 +117,10 @@ Service Accessors .. php:function:: old($key[, $default = null,[, $escape = 'html']]) :param string $key: The name of the old form data to check for. - :param mixed $default: The default value to return if $key doesn't exist. - :param mixed $escape: An `escape <#esc>`_ context or false to disable it. + :param string|null $default: The default value to return if $key doesn't exist. + :param false|string $escape: An `escape <#esc>`_ context or false to disable it. :returns: The value of the defined key, or the default value. - :rtype: mixed + :rtype: array|string|null Provides a simple way to access "old input data" from submitting a form. From d8aef2c95d6a77044cb7a8f2daa81636b491b6ac Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 07:57:53 +0900 Subject: [PATCH 144/237] docs: make description more precise --- user_guide_src/source/general/common_functions.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index c8f17f09746c..cd93382c8fd7 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -128,8 +128,10 @@ Service Accessors .. literalinclude:: common_functions/002.php -.. note:: If you are using the :doc:`form helper `, this feature is built-in. You only - need to use this function when not using the form helper. +.. note:: If you are using the :php:func:`set_value()`, :php:func:`set_select()`, + :php:func:`set_checkbox()`, and :php:func:`set_radio()` functions in + :doc:`form helper `, this feature is built-in. You only + need to use this function when not using the form helper. .. php:function:: session([$key]) From ca4a6ba2888b2c4926457f036ad8bfead82cc3a9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 08:13:25 +0900 Subject: [PATCH 145/237] docs: fix incorrect sample code The length of a UUID is 128 bits. That is 32 chars, but typically expressed with a structure of 8-4-4-4-12 separated by hyphens. Co-authored-by: Michal Sniatala --- user_guide_src/source/libraries/validation/038.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/libraries/validation/038.php b/user_guide_src/source/libraries/validation/038.php index 538a7f724dd3..1330267ebfce 100644 --- a/user_guide_src/source/libraries/validation/038.php +++ b/user_guide_src/source/libraries/validation/038.php @@ -3,10 +3,10 @@ // is_unique[table.field,ignore_field,ignore_value] $validation->setRules([ - 'name' => "max_length[30]|is_unique[supplier.name,uuid, {$uuid}]", // is not ok - 'name' => "max_length[30]|is_unique[supplier.name,uuid,{$uuid} ]", // is not ok - 'name' => "max_length[30]|is_unique[supplier.name,uuid,{$uuid}]", // is ok - 'name' => 'max_length[30]|is_unique[supplier.name,uuid,{uuid}]', // is ok - see "Validation Placeholders" + 'name' => "max_length[36]|is_unique[supplier.name,uuid, {$uuid}]", // is not ok + 'name' => "max_length[36]|is_unique[supplier.name,uuid,{$uuid} ]", // is not ok + 'name' => "max_length[36]|is_unique[supplier.name,uuid,{$uuid}]", // is ok + 'name' => 'max_length[36]|is_unique[supplier.name,uuid,{uuid}]', // is ok - see "Validation Placeholders" ]); // Warning: If `$uuid` is a user input, be sure to validate the format of the value before using it. // Otherwise, it is vulnerable. From b81d4c378e4815c0d817c80a004010804d35475e Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 09:15:29 +0900 Subject: [PATCH 146/237] docs: fix heading marks --- user_guide_src/source/general/modules.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 5bfbdf7b75d7..adc98e5e178a 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -11,9 +11,9 @@ language files, etc. Modules may contain as few, or as many, of these as you lik :local: :depth: 2 -========== +********** Namespaces -========== +********** The core element of the modules functionality comes from the :doc:`PSR-4 compatible autoloading <../concepts/autoloader>` that CodeIgniter uses. While any code can use the PSR-4 autoloader and namespaces, the primary way to take full advantage of @@ -58,9 +58,9 @@ Of course, there is nothing forcing you to use this exact structure, and you sho best suits your module, leaving out directories you don't need, creating new directories for Entities, Interfaces, or Repositories, etc. -=========================== +*************************** Autoloading Non-class Files -=========================== +*************************** More often than not that your module will not contain only PHP classes but also others like procedural functions, bootstrapping files, module constants files, etc. which are not normally loaded the way classes @@ -73,9 +73,9 @@ your classes. All we need to do is provide the list of paths to those files and .. literalinclude:: modules/002.php -============== +************** Auto-Discovery -============== +************** Many times, you will need to specify the full namespace to files you want to include, but CodeIgniter can be configured to make integrating modules into your applications simpler by automatically discovering many different @@ -134,9 +134,9 @@ by editing the ``$discoverInComposer`` variable in **app/Config/Modules.php**: .. literalinclude:: modules/004.php -================== +****************** Working with Files -================== +****************** This section will take a look at each of the file types (controllers, views, language files, etc) and how they can be used within the module. Some of this information is described in more detail in the relevant location of the user From 5e6f96ae9b4ee57f748aa949da00a0c19734249a Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 09:20:15 +0900 Subject: [PATCH 147/237] docs: improve references --- user_guide_src/source/general/configuration.rst | 2 +- user_guide_src/source/general/modules.rst | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 5d4c4a5e8737..2b3ee93427f6 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -288,7 +288,7 @@ There are two ways to implement a Registrar: implicit and explicit. Implicit Registrars =================== -Any namespace may define registrars by using the **Config/Registrar.php** file, if discovery +Any namespace may define registrars by using the **Config/Registrar.php** file, if :ref:`auto-discovery` is enabled in :doc:`Modules `. These files are classes whose methods are named for each configuration class you wish to extend. For example, a third-party module might wish to supply an additional template to ``Pager`` without overwriting whatever a develop has diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index adc98e5e178a..fe55de3423ce 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -73,6 +73,8 @@ your classes. All we need to do is provide the list of paths to those files and .. literalinclude:: modules/002.php +.. _auto-discovery: + ************** Auto-Discovery ************** @@ -83,7 +85,7 @@ file types, including: - :doc:`Events <../extending/events>` - :doc:`Filters <../incoming/filters>` -- :doc:`Registrars <./configuration>` +- :ref:`registrars` - :doc:`Route files <../incoming/routing>` - :doc:`Services <../concepts/services>` From b0db781e55ecbcdcccbf33621d4a84640a8ae6e7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 09:26:14 +0900 Subject: [PATCH 148/237] docs: remove leading `/` in example path --- user_guide_src/source/general/modules.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index fe55de3423ce..6fa8c1735698 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -93,7 +93,7 @@ This is configured in the file **app/Config/Modules.php**. The auto-discovery system works by scanning for particular directories and files within psr4 namespaces that have been defined in **Config/Autoload.php**. -The discovery process would look for discoverable items on that path and should, for example, find the routes file at **/acme/Blog/Config/Routes.php**. +The discovery process would look for discoverable items on that path and should, for example, find the routes file at **acme/Blog/Config/Routes.php**. Enable/Disable Discover ======================= From 9d19dd6dfcd716715cbcb5446c03253d3d6e3290 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 6 Jul 2023 09:32:16 +0900 Subject: [PATCH 149/237] docs: add about Composer packages --- user_guide_src/source/general/modules.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 6fa8c1735698..ec3773958998 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -91,7 +91,7 @@ file types, including: This is configured in the file **app/Config/Modules.php**. -The auto-discovery system works by scanning for particular directories and files within psr4 namespaces that have been defined in **Config/Autoload.php**. +The auto-discovery system works by scanning for particular directories and files within psr4 namespaces that have been defined in **Config/Autoload.php** and Composer packages. The discovery process would look for discoverable items on that path and should, for example, find the routes file at **acme/Blog/Config/Routes.php**. @@ -99,7 +99,7 @@ Enable/Disable Discover ======================= You can turn on or off all auto-discovery in the system with the ``$enabled`` class variable. False will disable -all discovery, optimizing performance, but negating the special capabilities of your modules. +all discovery, optimizing performance, but negating the special capabilities of your modules and Composer packages. Specify Discovery Items ======================= From fdc7bd53c9635258a13657a72c3a29e0e3545999 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 12:59:12 +0900 Subject: [PATCH 150/237] docs: improve description --- user_guide_src/source/general/configuration.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 2b3ee93427f6..7c107cfd5b92 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -281,6 +281,7 @@ Registrars "Registrars" are any other classes which might provide additional configuration properties. Registrars provide a means of altering a configuration at runtime across namespaces and files. + There are two ways to implement a Registrar: implicit and explicit. .. note:: Values from **.env** always take priority over Registrars. @@ -290,8 +291,10 @@ Implicit Registrars Any namespace may define registrars by using the **Config/Registrar.php** file, if :ref:`auto-discovery` is enabled in :doc:`Modules `. These files are classes whose methods are -named for each configuration class you wish to extend. For example, a third-party module might -wish to supply an additional template to ``Pager`` without overwriting whatever a develop has +named for each configuration class you wish to extend. + +For example, a third-party module or Composer package might +wish to supply an additional template to ``Config\Pager`` without overwriting whatever a developer has already configured. In **src/Config/Registrar.php** there would be a ``Registrar`` class with the single ``Pager()`` method (note the case-sensitivity): From 5fec4b6007e4d217182cd982b7d325ba986cae96 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 12:59:30 +0900 Subject: [PATCH 151/237] docs: improve sample code --- user_guide_src/source/general/configuration/007.php | 2 ++ user_guide_src/source/general/configuration/008.php | 2 ++ user_guide_src/source/general/configuration/009.php | 4 ++-- user_guide_src/source/general/configuration/010.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/configuration/007.php b/user_guide_src/source/general/configuration/007.php index 3a77c1ca5aa6..5298a99b1367 100644 --- a/user_guide_src/source/general/configuration/007.php +++ b/user_guide_src/source/general/configuration/007.php @@ -1,5 +1,7 @@ 45, From 3295b205bde84c12489beefc637a7dd69097e8da Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 13:06:16 +0900 Subject: [PATCH 152/237] docs: improve description Registrars work only if Auto-Discovery is enabled. --- user_guide_src/source/general/configuration.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 7c107cfd5b92..cc524e43ca39 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -282,15 +282,16 @@ Registrars "Registrars" are any other classes which might provide additional configuration properties. Registrars provide a means of altering a configuration at runtime across namespaces and files. -There are two ways to implement a Registrar: implicit and explicit. +Registrars work if :ref:`auto-discovery` is enabled in :doc:`Modules `. +There are two ways to implement a Registrar: **implicit** and **explicit**. .. note:: Values from **.env** always take priority over Registrars. Implicit Registrars =================== -Any namespace may define registrars by using the **Config/Registrar.php** file, if :ref:`auto-discovery` -is enabled in :doc:`Modules `. These files are classes whose methods are +Any namespace may define registrars by using the **Config/Registrar.php** file. +These files are classes whose methods are named for each configuration class you wish to extend. For example, a third-party module or Composer package might From cd52324f94e4ce84371639a88d51d577d0edb8f1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 13:15:22 +0900 Subject: [PATCH 153/237] docs: add explanation --- user_guide_src/source/general/configuration.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index cc524e43ca39..50f67dc1c82c 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -283,6 +283,8 @@ Registrars Registrars provide a means of altering a configuration at runtime across namespaces and files. Registrars work if :ref:`auto-discovery` is enabled in :doc:`Modules `. +It alters configuration properties when the Config object is instantiated. + There are two ways to implement a Registrar: **implicit** and **explicit**. .. note:: Values from **.env** always take priority over Registrars. From 92d10b28ddebec42ecfdc6e284e9b3fd94ddd26e Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 08:25:22 +0900 Subject: [PATCH 154/237] docs: clarify what two registrars can do --- user_guide_src/source/general/configuration.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 50f67dc1c82c..27a64b435913 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -292,9 +292,11 @@ There are two ways to implement a Registrar: **implicit** and **explicit**. Implicit Registrars =================== -Any namespace may define registrars by using the **Config/Registrar.php** file. -These files are classes whose methods are -named for each configuration class you wish to extend. +Implicit Registrars can change any Config class properties. + +Any namespace may define implicit registrars by using the **Config/Registrar.php** +file. These files are classes whose methods are named for each configuration class +you wish to extend. For example, a third-party module or Composer package might wish to supply an additional template to ``Config\Pager`` without overwriting whatever a developer has @@ -310,6 +312,9 @@ overwrite priority. Explicit Registrars =================== +Explicit Registrars can only change the Config class properties in which they are +registered. + A configuration file can also specify any number of registrars explicitly. This is done by adding a ``$registrars`` property to your configuration file, holding an array of the names of candidate registrars: From c79698fce9b0264aecc31191a860a4169c842be4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 22:06:02 +0900 Subject: [PATCH 155/237] docs: add config() in Global Functions --- user_guide_src/source/concepts/factories.rst | 4 +++- .../source/general/common_functions.rst | 15 +++++++++++++++ user_guide_src/source/general/configuration.rst | 4 +++- user_guide_src/source/general/modules.rst | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/concepts/factories.rst b/user_guide_src/source/concepts/factories.rst index c043bb6428b0..b3ec0a064176 100644 --- a/user_guide_src/source/concepts/factories.rst +++ b/user_guide_src/source/concepts/factories.rst @@ -99,10 +99,12 @@ Convenience Functions Two shortcut functions for Factories have been provided. These functions are always available. +.. _factories-config: + config() ======== -The first is ``config()`` which returns a new instance of a Config class. The only required parameter is the class name: +The first is :php:func:`config()` which returns a new instance of a Config class. The only required parameter is the class name: .. literalinclude:: factories/008.php diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst index 6a823bd46ec1..9430ae11a12b 100755 --- a/user_guide_src/source/general/common_functions.rst +++ b/user_guide_src/source/general/common_functions.rst @@ -30,6 +30,21 @@ Service Accessors .. literalinclude:: common_functions/001.php +.. php:function:: config(string $name[, bool $getShared = true]) + + :param string $name: The config classname. + :param bool $getShared: Whether to return a shared instance. + :returns: The config instances. + :rtype: object|null + + More simple way of getting config instances from Factories. + + See :ref:`Configuration ` and + :ref:`Factories ` for details. + + The ``config()`` uses ``Factories::config()`` internally. + See :ref:`factories-loading-class` for details on the first parameter ``$name``. + .. php:function:: cookie(string $name[, string $value = ''[, array $options = []]]) :param string $name: Cookie name diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 5d4c4a5e8737..a8aa34da90df 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -30,10 +30,12 @@ By using the ``new`` keyword to create an instance: .. literalinclude:: configuration/001.php +.. _configuration-config: + config() -------- -By using the ``config()`` function: +By using the :php:func:`config()` function: .. literalinclude:: configuration/002.php diff --git a/user_guide_src/source/general/modules.rst b/user_guide_src/source/general/modules.rst index 5bfbdf7b75d7..a608a7806ec8 100644 --- a/user_guide_src/source/general/modules.rst +++ b/user_guide_src/source/general/modules.rst @@ -187,7 +187,7 @@ with the ``new`` command: .. literalinclude:: modules/008.php -Config files are automatically discovered whenever using the ``config()`` function that is always available. +Config files are automatically discovered whenever using the :php:func:`config()` function that is always available. .. note:: We don't recommend you use the same short classname in modules. Modules that need to override or add to known configurations in **app/Config/** should use :ref:`registrars`. From a8a53e70cd9715054205ba44ece8acf44c1808ca Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:32:19 +0900 Subject: [PATCH 156/237] docs: change TOC depth to 3 --- user_guide_src/source/models/model.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 6fe16326cdd1..accd3dc35f90 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -4,7 +4,7 @@ Using CodeIgniter's Model .. contents:: :local: - :depth: 2 + :depth: 3 Models ****** From a8eec1efe0dd19a27a4634c2ff45107513b170a6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:32:55 +0900 Subject: [PATCH 157/237] docs: add sub section titles --- user_guide_src/source/models/model.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index accd3dc35f90..60f7e202b653 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -473,6 +473,9 @@ prior to saving to the database with the ``insert()``, ``update()``, or ``save() If you want to check required fields, you can change the behavior by configuration. See :ref:`clean-validation-rules` for details. +Setting Validation Rules +------------------------ + The first step is to fill out the ``$validationRules`` class property with the fields and rules that should be applied. If you have custom error message that you want to use, place them in the ``$validationMessages`` array: @@ -528,8 +531,16 @@ The other way to set the validation message to fields by functions, .. literalinclude:: model/031.php +Getting Validation Result +------------------------- + Now, whenever you call the ``insert()``, ``update()``, or ``save()`` methods, the data will be validated. If it fails, -the model will return boolean **false**. You can use the ``errors()`` method to retrieve the validation errors: +the model will return boolean **false**. + +Getting Validation Errors +------------------------- + +You can use the ``errors()`` method to retrieve the validation errors: .. literalinclude:: model/032.php From 947a10405c838d4d8aca9c0e9ab9239e568fc157 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:36:01 +0900 Subject: [PATCH 158/237] docs: move paragraph to correct section --- user_guide_src/source/models/model.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 60f7e202b653..0556eca4b636 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -481,6 +481,11 @@ be applied. If you have custom error message that you want to use, place them in .. literalinclude:: model/027.php +If you'd rather organize your rules and error messages within the Validation configuration file, you can do that +and simply set ``$validationRules`` to the name of the validation rule group you created: + +.. literalinclude:: model/034.php + The other way to set the validation rules to fields by functions, .. php:namespace:: CodeIgniter @@ -549,11 +554,6 @@ errors at the top of the form, or to display them individually: .. literalinclude:: model/033.php -If you'd rather organize your rules and error messages within the Validation configuration file, you can do that -and simply set ``$validationRules`` to the name of the validation rule group you created: - -.. literalinclude:: model/034.php - Retrieving Validation Rules --------------------------- From bf965a1a579a5684ed9207d2bc636506f3a2c479 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:44:50 +0900 Subject: [PATCH 159/237] docs: add note for validation placeholders --- user_guide_src/source/models/model.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 0556eca4b636..427f0eb51df9 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -583,6 +583,9 @@ replaced by the **value** of the matched incoming field. An example should clari .. literalinclude:: model/038.php +.. note:: Since v4.3.5, you must set the validation rules for the placeholder + field (``id``). + In this set of rules, it states that the email address should be unique in the database, except for the row that has an id matching the placeholder's value. Assuming that the form POST data had the following: @@ -594,6 +597,9 @@ then the ``{id}`` placeholder would be replaced with the number **4**, giving th So it will ignore the row in the database that has ``id=4`` when it verifies the email is unique. +.. note:: Since v4.3.5, if the placeholder (``id``) value does not pass the + validation, the placeholder would not be replaced. + This can also be used to create more dynamic rules at runtime, as long as you take care that any dynamic keys passed in don't conflict with your form data. From c9924db6d9f64ac87b351eb97d5bf6e05d39e426 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:45:08 +0900 Subject: [PATCH 160/237] docs: update sample code for validation placeholder --- user_guide_src/source/models/model/038.php | 3 ++- user_guide_src/source/models/model/040.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/models/model/038.php b/user_guide_src/source/models/model/038.php index 820d37def40c..5ed40baae0eb 100644 --- a/user_guide_src/source/models/model/038.php +++ b/user_guide_src/source/models/model/038.php @@ -7,6 +7,7 @@ class MyModel extends Model { protected $validationRules = [ - 'email' => 'required|valid_email|is_unique[users.email,id,{id}]', + 'id' => 'max_length[19]|is_natural_no_zero', + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,{id}]', ]; } diff --git a/user_guide_src/source/models/model/040.php b/user_guide_src/source/models/model/040.php index 6e1ff1711960..df4d628d1c9d 100644 --- a/user_guide_src/source/models/model/040.php +++ b/user_guide_src/source/models/model/040.php @@ -7,6 +7,7 @@ class MyModel extends Model { protected $validationRules = [ - 'email' => 'required|valid_email|is_unique[users.email,id,4]', + 'id' => 'max_length[19]|is_natural_no_zero', + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email,id,4]', ]; } From 5a0f9cb09404b66229be0d7e40b42747fb59a694 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 06:48:12 +0900 Subject: [PATCH 161/237] docs: add max_length to sample code --- user_guide_src/source/models/model/027.php | 8 ++++---- user_guide_src/source/models/model/028.php | 2 +- user_guide_src/source/models/model/029.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/user_guide_src/source/models/model/027.php b/user_guide_src/source/models/model/027.php index 5c457a09dce3..3a039df49465 100644 --- a/user_guide_src/source/models/model/027.php +++ b/user_guide_src/source/models/model/027.php @@ -7,10 +7,10 @@ class UserModel extends Model { protected $validationRules = [ - 'username' => 'required|alpha_numeric_space|min_length[3]', - 'email' => 'required|valid_email|is_unique[users.email]', - 'password' => 'required|min_length[8]', - 'pass_confirm' => 'required_with[password]|matches[password]', + 'username' => 'required|max_length[30]|alpha_numeric_space|min_length[3]', + 'email' => 'required|max_length[254]|valid_email|is_unique[users.email]', + 'password' => 'required|max_length[255]|min_length[8]', + 'pass_confirm' => 'required_with[password]|max_length[255]|matches[password]', ]; protected $validationMessages = [ 'email' => [ diff --git a/user_guide_src/source/models/model/028.php b/user_guide_src/source/models/model/028.php index acffbf22be01..9cea0eb31226 100644 --- a/user_guide_src/source/models/model/028.php +++ b/user_guide_src/source/models/model/028.php @@ -1,6 +1,6 @@ setValidationRule($fieldName, $fieldRules); diff --git a/user_guide_src/source/models/model/029.php b/user_guide_src/source/models/model/029.php index b7876797a6e2..93ba8ae51ffc 100644 --- a/user_guide_src/source/models/model/029.php +++ b/user_guide_src/source/models/model/029.php @@ -1,9 +1,9 @@ 'required|alpha_numeric_space|min_length[3]', + 'username' => 'required|max_length[30]|alpha_numeric_space|min_length[3]', 'email' => [ - 'rules' => 'required|valid_email|is_unique[users.email]', + 'rules' => 'required|max_length[254]|valid_email|is_unique[users.email]', 'errors' => [ 'required' => 'We really need your email.', ], From eda2ff45433d9c5bd0199a5b37e2c0ff28a37a03 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 08:37:54 +0900 Subject: [PATCH 162/237] docs: add note for In-Model Validation --- user_guide_src/source/helpers/form_helper.rst | 12 ++++++++++++ user_guide_src/source/models/model.rst | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 6bb94e319840..7571429241f3 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -536,6 +536,10 @@ The following functions are available: The returned array is the same as ``Validation::getErrors()``. See :ref:`Validation ` for details. + .. note:: This function does not work with :ref:`in-model-validation`. If you + want to get the validation errors in model validation, see + :ref:`model-getting-validation-errors`. + Example:: @@ -555,6 +559,10 @@ The following functions are available: This function uses :php:func:`validation_errors()` internally. + .. note:: This function does not work with :ref:`in-model-validation`. If you + want to get the validation errors in model validation, see + :ref:`model-getting-validation-errors`. + Example:: @@ -575,6 +583,10 @@ The following functions are available: This function uses :php:func:`validation_errors()` internally. + .. note:: This function does not work with :ref:`in-model-validation`. If you + want to get the validation errors in model validation, see + :ref:`model-getting-validation-errors`. + Example:: diff --git a/user_guide_src/source/models/model.rst b/user_guide_src/source/models/model.rst index 427f0eb51df9..46bc5908cb41 100644 --- a/user_guide_src/source/models/model.rst +++ b/user_guide_src/source/models/model.rst @@ -456,6 +456,8 @@ Cleans out the database table by permanently removing all rows that have 'delete .. literalinclude:: model/026.php +.. _in-model-validation: + In-Model Validation =================== @@ -542,6 +544,8 @@ Getting Validation Result Now, whenever you call the ``insert()``, ``update()``, or ``save()`` methods, the data will be validated. If it fails, the model will return boolean **false**. +.. _model-getting-validation-errors: + Getting Validation Errors ------------------------- From ff3dd1cdc2c3d7274518785b82968030d5d69276 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 09:26:38 +0900 Subject: [PATCH 163/237] test: add test to reproduce bug --- .../_support/View/OtherCells/SampleClass.php | 26 +++++++++++++++++++ tests/system/View/CellTest.php | 11 ++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/_support/View/OtherCells/SampleClass.php diff --git a/tests/_support/View/OtherCells/SampleClass.php b/tests/_support/View/OtherCells/SampleClass.php new file mode 100644 index 000000000000..cff88bc58c4f --- /dev/null +++ b/tests/_support/View/OtherCells/SampleClass.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Tests\Support\View\OtherCells; + +/** + * Two classes with the same short name. + * + * - Tests\Support\View\SampleClass + * - Tests\Support\View\OtherCells\SampleClass + */ +class SampleClass +{ + public function hello() + { + return 'Good-bye!'; + } +} diff --git a/tests/system/View/CellTest.php b/tests/system/View/CellTest.php index 33dd3984bd0d..5c1863236ab1 100644 --- a/tests/system/View/CellTest.php +++ b/tests/system/View/CellTest.php @@ -113,6 +113,17 @@ public function testDisplayRendersWithNamespacedClass() $this->assertSame($expected, $this->cell->render('\Tests\Support\View\SampleClass::hello')); } + public function testDisplayRendersTwoCellsWithSameShortName() + { + $output = $this->cell->render('\Tests\Support\View\SampleClass::hello'); + + $this->assertSame('Hello', $output); + + $output = $this->cell->render('\Tests\Support\View\OtherCells\SampleClass::hello'); + + $this->assertSame('Good-bye!', $output); + } + public function testDisplayRendersWithValidParamString() { $params = 'one=two,three=four'; From c193ce7ccd20bebbc4027d21629dbc92079e1edc Mon Sep 17 00:00:00 2001 From: kenjis Date: Sun, 9 Jul 2023 09:35:29 +0900 Subject: [PATCH 164/237] fix: view_cell() cannot load classes with the same short name --- system/View/Cell.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/View/Cell.php b/system/View/Cell.php index 5d575bced1e7..5c4d0ce2e99f 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -178,7 +178,8 @@ protected function determineClass(string $library): array } // locate and return an instance of the cell - $object = Factories::cells($class); + // @TODO extend Factories to be able to load classes with the same short name. + $object = class_exists($class) ? new $class() : Factories::cells($class); if (! is_object($object)) { throw ViewException::forInvalidCellClass($class); From bc2c9539e90c6e3febef5453f9b584d22a4dbdab Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 8 Jul 2023 22:35:06 +0800 Subject: [PATCH 165/237] refactor: [Redis Cache] fix phpstan baseline error --- phpstan-baseline.neon.dist | 5 ----- system/Cache/Handlers/RedisHandler.php | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist index 892f28ffa1c6..5fd27c7bbabd 100644 --- a/phpstan-baseline.neon.dist +++ b/phpstan-baseline.neon.dist @@ -10,11 +10,6 @@ parameters: count: 1 path: system/Autoloader/Autoloader.php - - - message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: system/Cache/Handlers/RedisHandler.php - - message: "#^Call to an undefined method CodeIgniter\\\\HTTP\\\\Request\\:\\:getPost\\(\\)\\.$#" count: 1 diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index 6874a86c8f2c..acb024ca0839 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -38,7 +38,7 @@ class RedisHandler extends BaseHandler /** * Redis connection * - * @var Redis + * @var Redis|null */ protected $redis; From 14171bf7036336f5b1bb8c2668859ea09d07e493 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 9 Jul 2023 19:01:26 +0700 Subject: [PATCH 166/237] [Rector] Remove findParentType() on RemoveErrorSuppressInTryCatchStmtsRector --- ...moveErrorSuppressInTryCatchStmtsRector.php | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php index d1b660b037aa..06c8ca39de4d 100644 --- a/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php +++ b/utils/Rector/RemoveErrorSuppressInTryCatchStmtsRector.php @@ -15,7 +15,10 @@ use PhpParser\Node; use PhpParser\Node\Expr\ErrorSuppress; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\TryCatch; +use PhpParser\NodeTraverser; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -45,29 +48,37 @@ public function getRuleDefinition(): RuleDefinition */ public function getNodeTypes(): array { - return [ErrorSuppress::class]; + return [TryCatch::class]; } /** - * @param ErrorSuppress $node + * @param TryCatch $node */ public function refactor(Node $node): ?Node { - $tryCatch = $this->betterNodeFinder->findParentType($node, TryCatch::class); + $hasChanged = false; - // not in try catch - if (! $tryCatch instanceof TryCatch) { - return null; - } + $this->traverseNodesWithCallable( + $node->stmts, + static function (Node $subNode) use (&$hasChanged) { + if ($subNode instanceof Class_ || $subNode instanceof Function_) { + return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN; + } + + if ($subNode instanceof ErrorSuppress) { + $hasChanged = true; + + return $subNode->expr; + } - $inStmts = (bool) $this->betterNodeFinder->findFirst((array) $tryCatch->stmts, static fn (Node $n): bool => $n === $node); + return null; + } + ); - // not in stmts, means it in catch or finally - if (! $inStmts) { - return null; + if ($hasChanged) { + return $node; } - // in try { ... } stmts - return $node->expr; + return null; } } From 416312e22d1bf6deddd50e4389830365ea359aeb Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 9 Jul 2023 19:56:13 +0700 Subject: [PATCH 167/237] [Rector] Remove findParentType() on UnderscoreToCamelCaseVariableNameRector --- ...nderscoreToCamelCaseVariableNameRector.php | 75 +++++++++++++++---- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index 31834cfc4e88..ea945e84a2df 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -15,10 +15,14 @@ use PhpParser\Comment\Doc; use PhpParser\Node; +use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\FunctionLike; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt\Namespace_; use Rector\Core\Php\ReservedKeywordAnalyzer; +use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace; use Rector\Core\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; @@ -35,6 +39,7 @@ final class UnderscoreToCamelCaseVariableNameRector extends AbstractRector private const PARAM_NAME_REGEX = '#(?@param\s.*\s+\$)(?%s)#ms'; private ReservedKeywordAnalyzer $reservedKeywordAnalyzer; + private bool $hasChanged = false; public function __construct( ReservedKeywordAnalyzer $reservedKeywordAnalyzer @@ -74,14 +79,59 @@ public function run($aB) */ public function getNodeTypes(): array { - return [Variable::class]; + return [FileWithoutNamespace::class, Namespace_::class]; } /** - * @param Variable $node + * @param ClassMethod|Closure|FileWithoutNamespace|Function_|Namespace_ $node */ public function refactor(Node $node): ?Node { + if ($node->stmts === null) { + return null; + } + + $this->hasChanged = false; + + $this->traverseNodesWithCallable( + $node->stmts, + function (Node $subNode) { + if ($subNode instanceof Variable || $subNode instanceof ClassMethod || $subNode instanceof Function_ || $subNode instanceof Closure) { + $this->processRenameVariable($subNode); + } + + return null; + } + ); + + if ($this->hasChanged) { + return $node; + } + + return null; + } + + private function processRenameVariable(FunctionLike|Variable $node): ?Variable + { + if ($node instanceof FunctionLike) { + if ($node instanceof Closure) { + foreach ($node->uses as $closureUse) { + $this->processRenameVariable($closureUse->var); + } + } + + foreach ($node->params as $key => $param) { + $originalVariableName = $param->var->name; + $variable = $this->processRenameVariable($param->var); + if ($variable instanceof Variable) { + $node->params[$key]->var = $variable; + $this->updateDocblock($originalVariableName, $variable->name, $node); + } + } + + return null; + } + $nodeName = $this->getName($node); if ($nodeName === null) { return null; @@ -105,24 +155,19 @@ public function refactor(Node $node): ?Node return null; } - $node->name = $camelCaseName; - $this->updateDocblock($node, $nodeName, $camelCaseName); + $node->name = $camelCaseName; + $this->hasChanged = true; return $node; } - private function updateDocblock(Variable $variable, string $variableName, string $camelCaseName): void + private function updateDocblock(string $variableName, string $camelCaseName, ?FunctionLike $functionLike): void { - $parentFunctionLike = $this->betterNodeFinder->findParentType($variable, ClassMethod::class); - - if ($parentFunctionLike === null) { - $parentFunctionLike = $this->betterNodeFinder->findParentType($variable, Function_::class); - if ($parentFunctionLike === null) { - return; - } + if ($functionLike === null) { + return; } - $docComment = $parentFunctionLike->getDocComment(); + $docComment = $functionLike->getDocComment(); if ($docComment === null) { return; } @@ -136,7 +181,7 @@ private function updateDocblock(Variable $variable, string $variableName, string return; } - $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($parentFunctionLike); + $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($functionLike); $paramTagValueNodes = $phpDocInfo->getParamTagValueNodes(); foreach ($paramTagValueNodes as $paramTagValueNode) { @@ -146,6 +191,6 @@ private function updateDocblock(Variable $variable, string $variableName, string } } - $parentFunctionLike->setDocComment(new Doc($phpDocInfo->getPhpDocNode()->__toString())); + $functionLike->setDocComment(new Doc($phpDocInfo->getPhpDocNode()->__toString())); } } From 3dc315f7cb951c7bc77c61c3d992537b5ebf0f2b Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 9 Jul 2023 19:58:39 +0700 Subject: [PATCH 168/237] Fix php syntax on php 7.4 compat --- utils/Rector/UnderscoreToCamelCaseVariableNameRector.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php index ea945e84a2df..3cadde86d3f7 100644 --- a/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php +++ b/utils/Rector/UnderscoreToCamelCaseVariableNameRector.php @@ -111,7 +111,10 @@ function (Node $subNode) { return null; } - private function processRenameVariable(FunctionLike|Variable $node): ?Variable + /** + * @param FunctionLike|Variable $node + */ + private function processRenameVariable(Node $node): ?Variable { if ($node instanceof FunctionLike) { if ($node instanceof Closure) { From c72fa247c75f2f059ff44c8887cf325f952a5367 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 13:00:27 +0900 Subject: [PATCH 169/237] fix: setValidationRule() cannot use with ruleGroup --- system/BaseModel.php | 19 +- system/Validation/Validation.php | 4 +- tests/_support/Config/Validation.php | 32 ++ tests/_support/Models/ValidModelRuleGroup.php | 27 + .../Models/ValidationModelRuleGroupTest.php | 476 ++++++++++++++++++ 5 files changed, 553 insertions(+), 5 deletions(-) create mode 100644 tests/_support/Config/Validation.php create mode 100644 tests/_support/Models/ValidModelRuleGroup.php create mode 100644 tests/system/Models/ValidationModelRuleGroupTest.php diff --git a/system/BaseModel.php b/system/BaseModel.php index 06b8190f037f..0f316e6ffa3f 100644 --- a/system/BaseModel.php +++ b/system/BaseModel.php @@ -1345,7 +1345,7 @@ public function skipValidation(bool $skip = true) } /** - * Allows to set validation messages. + * Allows to set (and reset) validation messages. * It could be used when you have to change default or override current validate messages. * * @param array $validationMessages Value @@ -1376,7 +1376,7 @@ public function setValidationMessage(string $field, array $fieldMessages) } /** - * Allows to set validation rules. + * Allows to set (and reset) validation rules. * It could be used when you have to change default or override current validate rules. * * @param array $validationRules Value @@ -1401,6 +1401,17 @@ public function setValidationRules(array $validationRules) */ public function setValidationRule(string $field, $fieldRules) { + $rules = $this->validationRules; + + // ValidationRules can be either a string, which is the group name, + // or an array of rules. + if (is_string($rules)) { + [$rules, $customErrors] = $this->validation->loadRuleGroup($rules); + + $this->validationRules = $rules; + $this->validationMessages = $this->validationMessages + $customErrors; + } + $this->validationRules[$field] = $fieldRules; return $this; @@ -1466,7 +1477,9 @@ public function getValidationRules(array $options = []): array // ValidationRules can be either a string, which is the group name, // or an array of rules. if (is_string($rules)) { - $rules = $this->validation->loadRuleGroup($rules); + [$rules, $customErrors] = $this->validation->loadRuleGroup($rules); + + $this->validationMessages = $this->validationMessages + $customErrors; } if (isset($options['except'])) { diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index cbfd396f325f..91e441356112 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -665,7 +665,7 @@ protected function loadRuleSets() * same format used with setRules(). Additionally, check * for {group}_errors for an array of custom error messages. * - * @return array + * @return array [rules, customErrors] * * @throws ValidationException */ @@ -693,7 +693,7 @@ public function loadRuleGroup(?string $group = null) $this->customErrors = $this->config->{$errorName}; } - return $this->rules; + return [$this->rules, $this->customErrors]; } /** diff --git a/tests/_support/Config/Validation.php b/tests/_support/Config/Validation.php new file mode 100644 index 000000000000..48be09084502 --- /dev/null +++ b/tests/_support/Config/Validation.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Tests\Support\Config; + +use Config\Validation as ValidationConfig; + +class Validation extends ValidationConfig +{ + public $signup = [ + 'id' => 'permit_empty|is_natural_no_zero', + 'name' => [ + 'required', + 'min_length[3]', + ], + 'token' => 'permit_empty|in_list[{id}]', + ]; + public $signup_errors = [ + 'name' => [ + 'required' => 'You forgot to name the baby.', + 'min_length' => 'Too short, man!', + ], + ]; +} diff --git a/tests/_support/Models/ValidModelRuleGroup.php b/tests/_support/Models/ValidModelRuleGroup.php new file mode 100644 index 000000000000..8b751b5f2409 --- /dev/null +++ b/tests/_support/Models/ValidModelRuleGroup.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace Tests\Support\Models; + +use CodeIgniter\Model; + +class ValidModelRuleGroup extends Model +{ + protected $table = 'job'; + protected $returnType = 'object'; + protected $useSoftDeletes = false; + protected $dateFormat = 'int'; + protected $allowedFields = [ + 'name', + 'description', + ]; + protected $validationRules = 'signup'; +} diff --git a/tests/system/Models/ValidationModelRuleGroupTest.php b/tests/system/Models/ValidationModelRuleGroupTest.php new file mode 100644 index 000000000000..f25dfbbf9735 --- /dev/null +++ b/tests/system/Models/ValidationModelRuleGroupTest.php @@ -0,0 +1,476 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace CodeIgniter\Models; + +use CodeIgniter\Database\BaseConnection; +use CodeIgniter\Model; +use Config\Services; +use stdClass; +use Tests\Support\Config\Validation; +use Tests\Support\Models\JobModel; +use Tests\Support\Models\SimpleEntity; +use Tests\Support\Models\ValidErrorsModel; +use Tests\Support\Models\ValidModelRuleGroup; + +/** + * @group DatabaseLive + * + * @internal + */ +final class ValidationModelRuleGroupTest extends LiveModelTestCase +{ + protected function setUp(): void + { + parent::setUp(); + + $this->createModel(ValidModelRuleGroup::class); + } + + protected function createModel(string $modelName, ?BaseConnection $db = null): Model + { + $config = new Validation(); + $validation = new \CodeIgniter\Validation\Validation($config, Services::renderer()); + + $this->db = $db ?? $this->db; + $this->model = new $modelName($this->db, $validation); + + return $this->model; + } + + public function testValid(): void + { + $data = [ + 'name' => 'some name', + 'description' => 'some great marketing stuff', + ]; + + $this->assertIsInt($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame([], $errors); + } + + public function testValidationBasics(): void + { + $data = [ + 'name' => null, + 'description' => 'some great marketing stuff', + ]; + + $this->assertFalse($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame('You forgot to name the baby.', $errors['name']); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/5859 + */ + public function testValidationTwice(): void + { + $data = [ + 'name' => null, + 'description' => 'some great marketing stuff', + ]; + + $this->assertFalse($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame('You forgot to name the baby.', $errors['name']); + + $data = [ + 'name' => 'some name', + 'description' => 'some great marketing stuff', + ]; + + $this->assertIsInt($this->model->insert($data)); + } + + public function testValidationWithSetValidationRule(): void + { + $data = [ + 'name' => 'some name', + 'description' => 'some great marketing stuff', + ]; + + $this->model->setValidationRule('description', [ + 'rules' => 'required|min_length[50]', + 'errors' => [ + 'min_length' => 'Description is too short baby.', + ], + ]); + $this->assertFalse($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame('Description is too short baby.', $errors['description']); + } + + public function testValidationWithSetValidationRules(): void + { + $data = [ + 'name' => '', + 'description' => 'some great marketing stuff', + ]; + + $this->model->setValidationRules([ + 'name' => [ + 'rules' => 'required', + 'errors' => [ + 'required' => 'Give me a name baby.', + ], + ], + 'description' => [ + 'rules' => 'required|min_length[50]', + 'errors' => [ + 'min_length' => 'Description is too short baby.', + ], + ], + ]); + $this->assertFalse($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame('Give me a name baby.', $errors['name']); + $this->assertSame('Description is too short baby.', $errors['description']); + } + + public function testValidationWithSetValidationMessage(): void + { + $data = [ + 'name' => null, + 'description' => 'some great marketing stuff', + ]; + + $this->model->setValidationMessage('name', [ + 'required' => 'Your baby name is missing.', + 'min_length' => 'Too short, man!', + ]); + $this->assertFalse($this->model->insert($data)); + + $errors = $this->model->errors(); + $this->assertSame('Your baby name is missing.', $errors['name']); + } + + public function testValidationPlaceholdersSuccess(): void + { + $data = [ + 'name' => 'abc', + 'id' => 13, + 'token' => 13, + ]; + + $this->assertTrue($this->model->validate($data)); + } + + public function testValidationPlaceholdersFail(): void + { + $data = [ + 'name' => 'abc', + 'id' => 13, + 'token' => 12, + ]; + + $this->assertFalse($this->model->validate($data)); + } + + public function testSkipValidation(): void + { + $data = [ + 'name' => '2', + 'description' => 'some great marketing stuff', + ]; + + $this->assertIsNumeric($this->model->skipValidation(true)->insert($data)); + } + + public function testCleanValidationRemovesAllWhenNoDataProvided(): void + { + $cleaner = $this->getPrivateMethodInvoker($this->model, 'cleanValidationRules'); + + $rules = [ + 'name' => 'required', + 'foo' => 'bar', + ]; + + $rules = $cleaner($rules, null); + $this->assertEmpty($rules); + } + + public function testCleanValidationRemovesOnlyForFieldsNotProvided(): void + { + $cleaner = $this->getPrivateMethodInvoker($this->model, 'cleanValidationRules'); + + $rules = [ + 'name' => 'required', + 'foo' => 'required', + ]; + + $data = [ + 'foo' => 'bar', + ]; + + $rules = $cleaner($rules, $data); + $this->assertArrayHasKey('foo', $rules); + $this->assertArrayNotHasKey('name', $rules); + } + + public function testCleanValidationReturnsAllWhenAllExist(): void + { + $cleaner = $this->getPrivateMethodInvoker($this->model, 'cleanValidationRules'); + + $rules = [ + 'name' => 'required', + 'foo' => 'required', + ]; + + $data = [ + 'foo' => 'bar', + 'name' => null, + ]; + + $rules = $cleaner($rules, $data); + $this->assertArrayHasKey('foo', $rules); + $this->assertArrayHasKey('name', $rules); + } + + public function testValidationPassesWithMissingFields(): void + { + $data = [ + 'foo' => 'bar', + ]; + + $result = $this->model->validate($data); + $this->assertTrue($result); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/1584 + */ + public function testUpdateWithValidation(): void + { + $data = [ + 'description' => 'This is a first test!', + 'name' => 'valid', + 'id' => 42, + 'token' => 42, + ]; + + $id = $this->model->insert($data); + $this->assertTrue((bool) $id); + + $data['description'] = 'This is a second test!'; + unset($data['name']); + + $result = $this->model->update($id, $data); + $this->assertTrue($result); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/1717 + */ + public function testRequiredWithValidationEmptyString(): void + { + $this->assertFalse($this->model->insert(['name' => ''])); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/1717 + */ + public function testRequiredWithValidationNull(): void + { + $this->assertFalse($this->model->insert(['name' => null])); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/1717 + */ + public function testRequiredWithValidationTrue(): void + { + $data = [ + 'name' => 'foobar', + 'description' => 'just because we have to', + ]; + + $this->assertNotFalse($this->model->insert($data)); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/1574 + */ + public function testValidationIncludingErrors(): void + { + $data = [ + 'description' => 'This is a first test!', + 'name' => 'valid', + 'id' => 42, + 'token' => 42, + ]; + + $this->createModel(ValidErrorsModel::class); + + $id = $this->model->insert($data); + $this->assertFalse((bool) $id); + $this->assertSame('Minimum Length Error', $this->model->errors()['name']); + } + + public function testValidationByObject(): void + { + $data = new stdClass(); + + $data->name = 'abc'; + $data->id = '13'; + $data->token = '13'; + + $this->assertTrue($this->model->validate($data)); + } + + public function testGetValidationRules(): void + { + $this->createModel(JobModel::class); + $this->setPrivateProperty($this->model, 'validationRules', ['description' => 'required']); + + $rules = $this->model->getValidationRules(); + $this->assertSame('required', $rules['description']); + } + + public function testGetValidationMessages(): void + { + $jobData = [ + [ + 'name' => 'Comedian', + 'description' => null, + ], + ]; + + $this->createModel(JobModel::class); + $this->setPrivateProperty($this->model, 'validationRules', ['description' => 'required']); + $this->setPrivateProperty($this->model, 'validationMessages', ['description' => 'Description field is required.']); + + $this->assertFalse($this->model->insertBatch($jobData)); + + $error = $this->model->getValidationMessages(); + $this->assertSame('Description field is required.', $error['description']); + } + + /** + * @see https://github.com/codeigniter4/CodeIgniter4/issues/6577 + */ + public function testUpdateEntityWithPropertyCleanValidationRulesTrueAndCallingCleanRulesFalse() + { + $model = new class () extends Model { + protected $table = 'test'; + protected $allowedFields = ['field1', 'field2', 'field3', 'field4']; + protected $returnType = SimpleEntity::class; + protected $validationRules = [ + 'field1' => 'required_with[field2,field3,field4]', + 'field2' => 'permit_empty', + 'field3' => 'permit_empty', + 'field4' => 'permit_empty', + ]; + }; + + // Simulate to get the entity from the database. + $entity = new SimpleEntity(); + $entity->setAttributes([ + 'id' => '1', + 'field1' => 'value1', + 'field2' => 'value2', + 'field3' => '', + 'field4' => '', + ]); + + // Change field1 value. + $entity->field1 = ''; + + // Set $cleanValidationRules to false by cleanRules() + $model->cleanRules(false)->save($entity); + + $errors = $model->errors(); + $this->assertCount(1, $errors); + $this->assertSame( + $errors['field1'], + 'The field1 field is required when field2,field3,field4 is present.' + ); + } + + public function testUpdateEntityWithPropertyCleanValidationRulesFalse() + { + $model = new class () extends Model { + protected $table = 'test'; + protected $allowedFields = ['field1', 'field2', 'field3', 'field4']; + protected $returnType = SimpleEntity::class; + protected $validationRules = [ + 'field1' => 'required_with[field2,field3,field4]', + 'field2' => 'permit_empty', + 'field3' => 'permit_empty', + 'field4' => 'permit_empty', + ]; + + // Set to false. + protected $cleanValidationRules = false; + }; + + // Simulate to get the entity from the database. + $entity = new SimpleEntity(); + $entity->setAttributes([ + 'id' => '1', + 'field1' => 'value1', + 'field2' => 'value2', + 'field3' => '', + 'field4' => '', + ]); + + // Change field1 value. + $entity->field1 = ''; + + $model->save($entity); + + $errors = $model->errors(); + $this->assertCount(1, $errors); + $this->assertSame( + $errors['field1'], + 'The field1 field is required when field2,field3,field4 is present.' + ); + } + + public function testInsertEntityValidateEntireRules() + { + $model = new class () extends Model { + protected $table = 'test'; + protected $allowedFields = ['field1', 'field2', 'field3', 'field4']; + protected $returnType = SimpleEntity::class; + protected $validationRules = [ + 'field1' => 'required', + 'field2' => 'required', + 'field3' => 'permit_empty', + 'field4' => 'permit_empty', + ]; + }; + + $entity = new SimpleEntity(); + $entity->setAttributes([ + 'field1' => 'value1', + // field2 is missing + 'field3' => '', + 'field4' => '', + ]); + + // Insert ignores $cleanValidationRules value. + $model->insert($entity); + + $errors = $model->errors(); + $this->assertCount(1, $errors); + $this->assertSame( + $errors['field2'], + 'The field2 field is required.' + ); + } +} From 919206896da970774abc2ec5c36e6c704f9a19d5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 13:22:05 +0900 Subject: [PATCH 170/237] docs: add changelog and upgrade guide --- user_guide_src/source/changelogs/v4.3.7.rst | 3 +++ user_guide_src/source/installation/upgrade_437.rst | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst index 47fc19f161d1..7bb8ba84b9e2 100644 --- a/user_guide_src/source/changelogs/v4.3.7.rst +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -15,6 +15,9 @@ BREAKING - **FeatureTestTrait:** When using :ref:`withBodyFormat() `, the priority of the request body has been changed. See :ref:`Upgrading Guide ` for details. +- **Validation:** The return value of ``Validation::loadRuleGroup()`` has been + changed from "**rules array**" to "**array** of **rules array** and **customErrors array**" + (``[rules, customErrors]``). Message Changes *************** diff --git a/user_guide_src/source/installation/upgrade_437.rst b/user_guide_src/source/installation/upgrade_437.rst index 389c145f4109..cc3e38fd030d 100644 --- a/user_guide_src/source/installation/upgrade_437.rst +++ b/user_guide_src/source/installation/upgrade_437.rst @@ -39,6 +39,19 @@ is not used:: Previously, the ``$body`` was used for the request body. +Return value of Validation::loadRuleGroup() +=========================================== + +The return value of ``Validation::loadRuleGroup()`` has been changed from +"**rules array**" to "**array** of **rules array** and **customErrors array**" +(``[rules, customErrors]``). + +If you use the method, update the code like the following:: + + $rules = $this->validation->loadRuleGroup($rules); + ↓ + [$rules, $customErrors] = $this->validation->loadRuleGroup($rules); + Breaking Enhancements ********************* From f45d036a032589647027810a84a11cd9be5e4ec4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 14:49:13 +0900 Subject: [PATCH 171/237] docs: fix sample code of Config\Validation --- user_guide_src/source/libraries/validation/003.php | 4 +++- user_guide_src/source/libraries/validation/013.php | 8 ++++++-- user_guide_src/source/libraries/validation/015.php | 10 +++++++--- user_guide_src/source/libraries/validation/016.php | 9 +++++++-- user_guide_src/source/libraries/validation/032.php | 8 ++++++-- user_guide_src/source/libraries/validation/033.php | 3 ++- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/user_guide_src/source/libraries/validation/003.php b/user_guide_src/source/libraries/validation/003.php index fbd3ee57980a..e83233803e7c 100644 --- a/user_guide_src/source/libraries/validation/003.php +++ b/user_guide_src/source/libraries/validation/003.php @@ -2,7 +2,9 @@ namespace Config; -class Validation +// ... + +class Validation extends BaseConfig { // ... diff --git a/user_guide_src/source/libraries/validation/013.php b/user_guide_src/source/libraries/validation/013.php index 383eb8153574..b43a32f97d4e 100644 --- a/user_guide_src/source/libraries/validation/013.php +++ b/user_guide_src/source/libraries/validation/013.php @@ -2,9 +2,13 @@ namespace Config; -class Validation +// ... + +class Validation extends BaseConfig { - public $signup = [ + // ... + + public array $signup = [ 'username' => 'required|max_length[30]', 'password' => 'required|max_length[255]', 'pass_confirm' => 'required|max_length[255]|matches[password]', diff --git a/user_guide_src/source/libraries/validation/015.php b/user_guide_src/source/libraries/validation/015.php index 91f9ac1c1c31..6e666e41c35d 100644 --- a/user_guide_src/source/libraries/validation/015.php +++ b/user_guide_src/source/libraries/validation/015.php @@ -2,16 +2,20 @@ namespace Config; -class Validation +// ... + +class Validation extends BaseConfig { - public $signup = [ + // ... + + public array $signup = [ 'username' => 'required|max_length[30]', 'password' => 'required|max_length[255]', 'pass_confirm' => 'required|max_length[255]|matches[password]', 'email' => 'required|max_length[254]|valid_email', ]; - public $signup_errors = [ + public array $signup_errors = [ 'username' => [ 'required' => 'You must choose a username.', ], diff --git a/user_guide_src/source/libraries/validation/016.php b/user_guide_src/source/libraries/validation/016.php index c11237a9cf09..1eb72bc8c62f 100644 --- a/user_guide_src/source/libraries/validation/016.php +++ b/user_guide_src/source/libraries/validation/016.php @@ -2,9 +2,13 @@ namespace Config; -class Validation +// ... + +class Validation extends BaseConfig { - public $signup = [ + // ... + + public array $signup = [ 'username' => [ 'rules' => 'required|max_length[30]', 'errors' => [ @@ -18,5 +22,6 @@ class Validation ], ], ]; + // ... } diff --git a/user_guide_src/source/libraries/validation/032.php b/user_guide_src/source/libraries/validation/032.php index acec3cfc6ba2..cf8bcf8b9bdc 100644 --- a/user_guide_src/source/libraries/validation/032.php +++ b/user_guide_src/source/libraries/validation/032.php @@ -2,9 +2,13 @@ namespace Config; -class Validation +// ... + +class Validation extends BaseConfig { - public $templates = [ + // ... + + public array $templates = [ 'list' => 'CodeIgniter\Validation\Views\list', 'single' => 'CodeIgniter\Validation\Views\single', 'my_list' => '_errors_list', diff --git a/user_guide_src/source/libraries/validation/033.php b/user_guide_src/source/libraries/validation/033.php index fe61b137f7e5..aa67529ba959 100644 --- a/user_guide_src/source/libraries/validation/033.php +++ b/user_guide_src/source/libraries/validation/033.php @@ -2,12 +2,13 @@ namespace Config; +use CodeIgniter\Config\BaseConfig; use CodeIgniter\Validation\CreditCardRules; use CodeIgniter\Validation\FileRules; use CodeIgniter\Validation\FormatRules; use CodeIgniter\Validation\Rules; -class Validation +class Validation extends BaseConfig { // ... From a6571c3a1f529ebd0af7a4c62a1d94f34a28e9f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:26:01 +0000 Subject: [PATCH 172/237] build(deps-dev): update rector/rector requirement from 0.17.2 to 0.17.3 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.2...0.17.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c7da41b6b216..5eb5760d6142 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.17.2", + "rector/rector": "0.17.3", "vimeo/psalm": "^5.0" }, "suggest": { From b35216056e487e3d64334f8f64f3261c59226141 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:18:24 +0900 Subject: [PATCH 173/237] docs: fix Section Headings marks --- .../source/installation/running.rst | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 0b974180f7e7..ce17b8a0aa46 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -1,3 +1,4 @@ +################ Running Your App ################ @@ -20,8 +21,9 @@ section of the User Guide to begin learning how to build dynamic PHP application .. _initial-configuration: +********************* Initial Configuration -===================== +********************* #. Open the **app/Config/App.php** file with a text editor and set your base URL to ``$baseURL``. If you need more flexibility, the baseURL may @@ -49,11 +51,12 @@ Initial Configuration your project, so that it is writable by the user or account used by your web server. +************************ Local Development Server -======================== +************************ CodeIgniter 4 comes with a local development server, leveraging PHP's built-in web server -with CodeIgniter routing. You can launch it, with the following command line +with CodeIgniter routing. You can launch it, with the following command line in the main directory:: > php spark serve @@ -83,8 +86,9 @@ The local development server can be customized with three command line options: > php spark serve --php /usr/bin/php7.6.5.4 +******************* Hosting with Apache -=================== +******************* A CodeIgniter4 webapp is normally hosted on a web server. Apache HTTP Server is the "standard" platform, and assumed in much of our documentation. @@ -93,7 +97,7 @@ Apache is bundled with many platforms, but can also be downloaded in a bundle with a database engine and PHP from `Bitnami `_. .htaccess ---------- +========= The "mod_rewrite" module enables URLs without "index.php" in them, and is assumed in our user guide. @@ -113,12 +117,12 @@ in the ``AllowOverride`` setting::
Removing the index.php ----------------------- +====================== See :ref:`CodeIgniter URLs `. Virtual Hosting ---------------- +=============== We recommend using "virtual hosting" to run your apps. You can set up different aliases for each of the apps you work on, @@ -148,7 +152,7 @@ If your project folder is not a subfolder of the Apache document root, then your ```` element may need a nested ```` element to grant the web server access to the files. With mod_userdir (Shared Hosts) --------------------------------- +=============================== A common practice in shared hosting environments is to use the Apache module "mod_userdir" to enable per-user Virtual Hosts automatically. Additional configuration is required to allow CodeIgniter4 to be run from these per-user directories. @@ -214,25 +218,26 @@ Be sure to specify options and permissions for the CodeIgniter public directory Setting Environment -------------------- +=================== See :ref:`Handling Multiple Environments `. Testing -------- +======= With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser. Apache needs to be restarted whenever you change its configuration. +****************** Hosting with Nginx -================== +****************** Nginx is the second most widely used HTTP server for web hosting. Here you can find an example configuration using PHP 8.1 FPM (unix sockets) under Ubuntu Server. default.conf ------------- +============ This configuration enables URLs without "index.php" in them and using CodeIgniter's "404 - File Not Found" for URLs ending with ".php". @@ -269,12 +274,13 @@ This configuration enables URLs without "index.php" in them and using CodeIgnite } Setting Environment -------------------- +=================== See :ref:`Handling Multiple Environments `. +********************* Bootstrapping the App -===================== +********************* In some scenarios you will want to load the framework without actually running the whole application. This is particularly useful for unit testing your project, but may also be From 35e5342899564e21ceb5f6b627752c7901b751bf Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:32:10 +0900 Subject: [PATCH 174/237] docs: indent config values in sample --- user_guide_src/source/installation/running.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index ce17b8a0aa46..4161233c0d94 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -143,9 +143,9 @@ e.g., **apache2/conf/extra/httpd-vhost.conf**:: DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public" - ServerName myproject.local - ErrorLog "logs/myproject-error_log" - CustomLog "logs/myproject-access_log" common + ServerName myproject.local + ErrorLog "logs/myproject-error_log" + CustomLog "logs/myproject-access_log" common If your project folder is not a subfolder of the Apache document root, then your From 92e5a8fd1e5b11bf931506253b0962ccf0ed8fea Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:31:46 +0900 Subject: [PATCH 175/237] docs: add sub section titles and fix --- .../source/installation/running.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 4161233c0d94..c7a5e7e5c4b8 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -96,8 +96,11 @@ Apache HTTP Server is the "standard" platform, and assumed in much of our docume Apache is bundled with many platforms, but can also be downloaded in a bundle with a database engine and PHP from `Bitnami `_. -.htaccess -========= +Configure Main Config File +========================== + +Enabling mod_rewrite +-------------------- The "mod_rewrite" module enables URLs without "index.php" in them, and is assumed in our user guide. @@ -107,6 +110,9 @@ configuration file, e.g., **apache2/conf/httpd.conf**:: LoadModule rewrite_module modules/mod_rewrite.so +Setting Document Root +--------------------- + Also make sure that the default document root's ```` element enables this too, in the ``AllowOverride`` setting:: @@ -127,17 +133,26 @@ Virtual Hosting We recommend using "virtual hosting" to run your apps. You can set up different aliases for each of the apps you work on, +Enabling vhost_alias_module +--------------------------- + Make sure that the virtual hosting module is enabled (uncommented) in the main configuration file, e.g., **apache2/conf/httpd.conf**:: LoadModule vhost_alias_module modules/mod_vhost_alias.so +Adding Host Alias +----------------- + Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms, or **c:/Windows/System32/drivers/etc/hosts** on Windows. Add a line to the file. This could be ``myproject.local`` or ``myproject.test``, for instance:: 127.0.0.1 myproject.local +Setting VirtualHost +------------------- + Add a ```` element for your webapp inside the virtual hosting configuration, e.g., **apache2/conf/extra/httpd-vhost.conf**:: From 0a1e43ad09f58459a35c06b1ee209c6936d76f13 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:51:25 +0900 Subject: [PATCH 176/237] docs: add new line --- user_guide_src/source/installation/running.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index c7a5e7e5c4b8..080235aeb19e 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -146,7 +146,9 @@ Adding Host Alias Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms, or **c:/Windows/System32/drivers/etc/hosts** on Windows. -Add a line to the file. This could be ``myproject.local`` or ``myproject.test``, for instance:: +Add a line to the file. + +This could be ``myproject.local`` or ``myproject.test``, for instance:: 127.0.0.1 myproject.local From c917982843ab55b3b492a715ee1516dbeb75a3f4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:51:44 +0900 Subject: [PATCH 177/237] docs: change sub section order --- .../source/installation/running.rst | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 080235aeb19e..ce19325ec6ef 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -122,11 +122,6 @@ in the ``AllowOverride`` setting:: Require all granted -Removing the index.php -====================== - -See :ref:`CodeIgniter URLs `. - Virtual Hosting =============== @@ -168,6 +163,13 @@ e.g., **apache2/conf/extra/httpd-vhost.conf**:: If your project folder is not a subfolder of the Apache document root, then your ```` element may need a nested ```` element to grant the web server access to the files. +Testing +======= + +With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser. + +Apache needs to be restarted whenever you change its configuration. + With mod_userdir (Shared Hosts) =============================== @@ -234,18 +236,16 @@ Be sure to specify options and permissions for the CodeIgniter public directory +Removing the index.php +====================== + +See :ref:`CodeIgniter URLs `. + Setting Environment =================== See :ref:`Handling Multiple Environments `. -Testing -======= - -With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser. - -Apache needs to be restarted whenever you change its configuration. - ****************** Hosting with Nginx ****************** From fdf3252d2503f15a28041df436fd8a81fe78a969 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:57:23 +0900 Subject: [PATCH 178/237] docs: change sub section titles and level --- user_guide_src/source/installation/running.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index ce19325ec6ef..4b99f2179258 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -122,8 +122,8 @@ in the ``AllowOverride`` setting:: Require all granted -Virtual Hosting -=============== +Hosting with VirtualHost +======================== We recommend using "virtual hosting" to run your apps. You can set up different aliases for each of the apps you work on, @@ -164,14 +164,14 @@ If your project folder is not a subfolder of the Apache document root, then your ```` element may need a nested ```` element to grant the web server access to the files. Testing -======= +------- With the above configuration, your webapp would be accessed with the URL **http://myproject.local/** in your browser. Apache needs to be restarted whenever you change its configuration. -With mod_userdir (Shared Hosts) -=============================== +Hosting with mod_userdir (Shared Hosts) +======================================= A common practice in shared hosting environments is to use the Apache module "mod_userdir" to enable per-user Virtual Hosts automatically. Additional configuration is required to allow CodeIgniter4 to be run from these per-user directories. From 18d5cf40091f314a24400338daf07b00c5f4eaee Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 09:59:20 +0900 Subject: [PATCH 179/237] docs: change TOC depth to 3 --- user_guide_src/source/installation/running.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 4b99f2179258..2c1a3dfdf2d0 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -4,7 +4,7 @@ Running Your App .. contents:: :local: - :depth: 2 + :depth: 3 A CodeIgniter 4 app can be run in a number of different ways: hosted on a web server, using virtualization, or using CodeIgniter's command line tool for testing. From eb465d945caffdaea55c2d087855c8e82ac1047a Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 11:01:31 +0900 Subject: [PATCH 180/237] docs: add ".. code-block:: apache" --- .../source/installation/running.rst | 100 ++++++++++-------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 2c1a3dfdf2d0..7b763c5ae616 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -106,7 +106,9 @@ The "mod_rewrite" module enables URLs without "index.php" in them, and is assume in our user guide. Make sure that the rewrite module is enabled (uncommented) in the main -configuration file, e.g., **apache2/conf/httpd.conf**:: +configuration file, e.g., **apache2/conf/httpd.conf**: + +.. code-block:: apache LoadModule rewrite_module modules/mod_rewrite.so @@ -114,7 +116,9 @@ Setting Document Root --------------------- Also make sure that the default document root's ```` element enables this too, -in the ``AllowOverride`` setting:: +in the ``AllowOverride`` setting: + +.. code-block:: apache Options Indexes FollowSymLinks @@ -132,7 +136,9 @@ Enabling vhost_alias_module --------------------------- Make sure that the virtual hosting module is enabled (uncommented) in the main -configuration file, e.g., **apache2/conf/httpd.conf**:: +configuration file, e.g., **apache2/conf/httpd.conf**: + +.. code-block:: apache LoadModule vhost_alias_module modules/mod_vhost_alias.so @@ -151,7 +157,9 @@ Setting VirtualHost ------------------- Add a ```` element for your webapp inside the virtual hosting configuration, -e.g., **apache2/conf/extra/httpd-vhost.conf**:: +e.g., **apache2/conf/extra/httpd-vhost.conf**: + +.. code-block:: apache DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public" @@ -179,60 +187,66 @@ The following assumes that the server is already configured for mod_userdir. A g Because CodeIgniter4 expects the server to find the framework front controller at **public/index.php** by default, you must specify this location as an alternative to search for the request (even if CodeIgniter4 is installed within the per-user web directory). -The default user web directory **~/public_html** is specified by the ``UserDir`` directive, typically in **apache2/mods-available/userdir.conf** or **apache2/conf/extra/httpd-userdir.conf**:: +The default user web directory **~/public_html** is specified by the ``UserDir`` directive, typically in **apache2/mods-available/userdir.conf** or **apache2/conf/extra/httpd-userdir.conf**: + +.. code-block:: apache UserDir public_html -So you will need to configure Apache to look for CodeIgniter's public directory first before trying to serve the default:: +So you will need to configure Apache to look for CodeIgniter's public directory first before trying to serve the default: + +.. code-block:: apache UserDir "public_html/public" "public_html" -Be sure to specify options and permissions for the CodeIgniter public directory as well. A **userdir.conf** might look like:: +Be sure to specify options and permissions for the CodeIgniter public directory as well. A **userdir.conf** might look like: + +.. code-block:: apache UserDir "public_html/public" "public_html" UserDir disabled root - AllowOverride All - Options MultiViews Indexes FollowSymLinks - - # Apache <= 2.2: - # Order allow,deny - # Allow from all - - # Apache >= 2.4: - Require all granted - - - # Apache <= 2.2: - # Order deny,allow - # Deny from all - - # Apache >= 2.4: - Require all denied - + AllowOverride All + Options MultiViews Indexes FollowSymLinks + + # Apache <= 2.2: + # Order allow,deny + # Allow from all + + # Apache >= 2.4: + Require all granted + + + # Apache <= 2.2: + # Order deny,allow + # Deny from all + + # Apache >= 2.4: + Require all denied + - AllowOverride All - Options MultiViews Indexes FollowSymLinks - - # Apache <= 2.2: - # Order allow,deny - # Allow from all - - # Apache >= 2.4: - Require all granted - - - # Apache <= 2.2: - # Order deny,allow - # Deny from all - - # Apache >= 2.4: - Require all denied - + AllowOverride All + Options MultiViews Indexes FollowSymLinks + + # Apache <= 2.2: + # Order allow,deny + # Allow from all + + # Apache >= 2.4: + Require all granted + + + # Apache <= 2.2: + # Order deny,allow + # Deny from all + + # Apache >= 2.4: + Require all denied + From 9afea6f090622e8fa58fa034591c6fa6a09b8ce2 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 13:32:36 +0900 Subject: [PATCH 181/237] docs: add new line --- user_guide_src/source/installation/running.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 7b763c5ae616..1aa88e9b8e64 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -147,8 +147,8 @@ Adding Host Alias Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms, or **c:/Windows/System32/drivers/etc/hosts** on Windows. -Add a line to the file. +Add a line to the file. This could be ``myproject.local`` or ``myproject.test``, for instance:: 127.0.0.1 myproject.local From d98ec38e635981ff025bed2b3a4252145e6fefb5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 13:32:52 +0900 Subject: [PATCH 182/237] docs: change location of project folder and explanin folder structure --- user_guide_src/source/installation/running.rst | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 1aa88e9b8e64..52b7281bf283 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -162,14 +162,25 @@ e.g., **apache2/conf/extra/httpd-vhost.conf**: .. code-block:: apache - DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public" + DocumentRoot "/opt/lamp/apache2/myproject/public" ServerName myproject.local ErrorLog "logs/myproject-error_log" CustomLog "logs/myproject-access_log" common + + + AllowOverride All + Require all granted + -If your project folder is not a subfolder of the Apache document root, then your -```` element may need a nested ```` element to grant the web server access to the files. +The above configuration assumes the project folder is located as follows: + +.. code-block:: text + + apache2/ + ├── myproject/ (Project Folder) + │ └── public/ (DocumentRoot for myproject.local) + └── htdocs/ Testing ------- From 45165e101c239902a59b7805bdeae29e7d08a0e0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 12 Jul 2023 06:36:24 +0900 Subject: [PATCH 183/237] docs: fix directory separator for Windows --- user_guide_src/source/installation/running.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index 52b7281bf283..eda284684642 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -146,7 +146,7 @@ Adding Host Alias ----------------- Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms, -or **c:/Windows/System32/drivers/etc/hosts** on Windows. +or **c:\Windows\System32\drivers\etc\hosts** on Windows. Add a line to the file. This could be ``myproject.local`` or ``myproject.test``, for instance:: From d2511e5efb9d93d384605b3ae33ba0c5487823ae Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 8 Jul 2023 11:06:42 +0900 Subject: [PATCH 184/237] docs: add "Hosting with Subfolder" --- .../source/installation/running.rst | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/user_guide_src/source/installation/running.rst b/user_guide_src/source/installation/running.rst index eda284684642..c75d4a24120c 100644 --- a/user_guide_src/source/installation/running.rst +++ b/user_guide_src/source/installation/running.rst @@ -182,6 +182,8 @@ The above configuration assumes the project folder is located as follows: │ └── public/ (DocumentRoot for myproject.local) └── htdocs/ +Restart Apache. + Testing ------- @@ -189,6 +191,77 @@ With the above configuration, your webapp would be accessed with the URL **http: Apache needs to be restarted whenever you change its configuration. +Hosting with Subfolder +====================== + +If you want a baseURL like **http://localhost/myproject/** with a subfolder, +there are three ways. + +Making Symlink +-------------- + +Place your project folder as follows, where **htdocs** is the Apache document root:: + + ├── myproject/ (project folder) + │ └── public/ + └── htdocs/ + +Navigate to the **htdocs** folder and create a symbolic link as follows:: + + > cd htdocs/ + > ln -s ../myproject/public/ myproject + +Using Alias +----------- + +Place your project folder as follows, where **htdocs** is the Apache document root:: + + ├── myproject/ (project folder) + │ └── public/ + └── htdocs/ + +Add the following in the main configuration file, e.g., **apache2/conf/httpd.conf**: + +.. code-block:: apache + + Alias /myproject /opt/lamp/apache2/myproject/public + + AllowOverride All + Require all granted + + +Restart Apache. + +Adding .htaccess +---------------- + +The last resort is to add **.htaccess** to the project root. + +It is not recommended that you place the project folder in the document root. +However, if you have no other choice, like on a shared server, you can use this. + +Place your project folder as follows, where **htdocs** is the Apache document root, +and create the **.htaccess** file:: + + └── htdocs/ + └── myproject/ (project folder) + ├── .htaccess + └── public/ + +And edit **.htaccess** as follows: + +.. code-block:: apache + + + RewriteEngine On + RewriteRule ^(.*)$ public/$1 [L] + + + + Require all denied + Satisfy All + + Hosting with mod_userdir (Shared Hosts) ======================================= From 00661b9cc288c0355e656a45e12225f8512e3d63 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 12 Jul 2023 12:15:01 +0900 Subject: [PATCH 185/237] docs: add comments --- system/Cache/Handlers/FileHandler.php | 2 ++ system/Cache/Handlers/MemcachedHandler.php | 3 +++ system/Cache/Handlers/PredisHandler.php | 3 +++ system/Cache/Handlers/RedisHandler.php | 3 +++ system/Cache/Handlers/WincacheHandler.php | 3 +++ 5 files changed, 14 insertions(+) diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 9d1179feb82a..524ee8e47720 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -44,6 +44,8 @@ class FileHandler extends BaseHandler protected $mode; /** + * Note: Use `CacheFactory::getHandler()` to instantiate. + * * @throws CacheException */ public function __construct(Cache $config) diff --git a/system/Cache/Handlers/MemcachedHandler.php b/system/Cache/Handlers/MemcachedHandler.php index 5053b1a6752a..f38a541113a1 100644 --- a/system/Cache/Handlers/MemcachedHandler.php +++ b/system/Cache/Handlers/MemcachedHandler.php @@ -42,6 +42,9 @@ class MemcachedHandler extends BaseHandler 'raw' => false, ]; + /** + * Note: Use `CacheFactory::getHandler()` to instantiate. + */ public function __construct(Cache $config) { $this->prefix = $config->prefix; diff --git a/system/Cache/Handlers/PredisHandler.php b/system/Cache/Handlers/PredisHandler.php index cf44f634e86b..ab4fb1ff0a46 100644 --- a/system/Cache/Handlers/PredisHandler.php +++ b/system/Cache/Handlers/PredisHandler.php @@ -43,6 +43,9 @@ class PredisHandler extends BaseHandler */ protected $redis; + /** + * Note: Use `CacheFactory::getHandler()` to instantiate. + */ public function __construct(Cache $config) { $this->prefix = $config->prefix; diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index acb024ca0839..adb9a581a75a 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -42,6 +42,9 @@ class RedisHandler extends BaseHandler */ protected $redis; + /** + * Note: Use `CacheFactory::getHandler()` to instantiate. + */ public function __construct(Cache $config) { $this->prefix = $config->prefix; diff --git a/system/Cache/Handlers/WincacheHandler.php b/system/Cache/Handlers/WincacheHandler.php index e422dc1fad00..c5f0f08467e9 100644 --- a/system/Cache/Handlers/WincacheHandler.php +++ b/system/Cache/Handlers/WincacheHandler.php @@ -22,6 +22,9 @@ */ class WincacheHandler extends BaseHandler { + /** + * Note: Use `CacheFactory::getHandler()` to instantiate. + */ public function __construct(Cache $config) { $this->prefix = $config->prefix; From c95912e11a71dec3f47416ee675ee4e86f606b79 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 09:31:43 +0900 Subject: [PATCH 186/237] fix: auto-routing legacy with $routes->add() behavior If you $routes->add(), the controller was inaccessible with auto-routing legacy. --- phpstan-baseline.neon.dist | 7 +----- system/Router/AutoRouter.php | 45 +++++++++++++++++++++--------------- system/Router/Router.php | 3 ++- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist index 5fd27c7bbabd..639b6dc79f5a 100644 --- a/phpstan-baseline.neon.dist +++ b/phpstan-baseline.neon.dist @@ -197,16 +197,11 @@ parameters: - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRegisteredControllers\\(.*\\)\\.$#" - count: 2 - path: system/Router/Router.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 path: system/Router/Router.php - - message: "#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRoutes\\(\\) invoked with 1 parameter, 0 required\\.$#" + message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 path: system/Router/Router.php diff --git a/system/Router/AutoRouter.php b/system/Router/AutoRouter.php index 3096b3bbd6f9..fb50f5a438fe 100644 --- a/system/Router/AutoRouter.php +++ b/system/Router/AutoRouter.php @@ -11,6 +11,7 @@ namespace CodeIgniter\Router; +use Closure; use CodeIgniter\Exceptions\PageNotFoundException; /** @@ -19,11 +20,11 @@ final class AutoRouter implements AutoRouterInterface { /** - * List of controllers registered for the CLI verb that should not be accessed in the web. + * List of CLI routes. * - * @var class-string[] + * @var array [routeKey => handler] */ - private array $protectedControllers; + private array $cliRoutes; /** * Sub-directory that contains the requested controller class. @@ -58,17 +59,17 @@ final class AutoRouter implements AutoRouterInterface private string $defaultNamespace; public function __construct( - array $protectedControllers, + array $cliRoutes, string $defaultNamespace, string $defaultController, string $defaultMethod, bool $translateURIDashes, string $httpVerb ) { - $this->protectedControllers = $protectedControllers; - $this->defaultNamespace = $defaultNamespace; - $this->translateURIDashes = $translateURIDashes; - $this->httpVerb = $httpVerb; + $this->cliRoutes = $cliRoutes; + $this->defaultNamespace = $defaultNamespace; + $this->translateURIDashes = $translateURIDashes; + $this->httpVerb = $httpVerb; $this->controller = $defaultController; $this->method = $defaultMethod; @@ -126,18 +127,24 @@ public function getRoute(string $uri, string $httpVerb): array $controller .= $controllerName; $controller = strtolower($controller); - - foreach ($this->protectedControllers as $controllerInRoute) { - if (! is_string($controllerInRoute)) { - continue; - } - if (strtolower($controllerInRoute) !== $controller) { - continue; + $methodName = strtolower($this->methodName()); + + foreach ($this->cliRoutes as $handler) { + if (is_string($handler)) { + $handler = strtolower($handler); + + if (strpos($handler, $controller . '::' . $methodName) === 0) { + throw new PageNotFoundException( + 'Cannot access CLI Route: ' . $uri + ); + } + + if ($handler === $controller) { + throw new PageNotFoundException( + 'Cannot access CLI Route: ' . $uri + ); + } } - - throw new PageNotFoundException( - 'Cannot access the controller in a CLI Route. Controller: ' . $controllerInRoute - ); } } diff --git a/system/Router/Router.php b/system/Router/Router.php index be698003cbe5..6d01de217e20 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -145,7 +145,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request ); } else { $this->autoRouter = new AutoRouter( - $this->collection->getRegisteredControllers('cli'), + $this->collection->getRoutes('cli'), // @phpstan-ignore-line $this->collection->getDefaultNamespace(), $this->collection->getDefaultController(), $this->collection->getDefaultMethod(), @@ -393,6 +393,7 @@ public function getLocale() */ protected function checkRoutes(string $uri): bool { + // @phpstan-ignore-next-line $routes = $this->collection->getRoutes($this->collection->getHTTPVerb()); // Don't waste any time From 7493f07d63d9496abcc16d620160d9d34235d6be Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 09:34:53 +0900 Subject: [PATCH 187/237] docs: change order of sentences --- user_guide_src/source/incoming/routing.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index a5d195f53e46..f1f4253b3c41 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -324,10 +324,12 @@ Command-Line Only Routes .. note:: It is recommended to use Spark Commands for CLI scripts instead of calling controllers via CLI. See the :doc:`../cli/cli_commands` page for detailed information. -You can create routes that work only from the command-line, and are inaccessible from the web browser, with the -``cli()`` method. Any route created by any of the HTTP-verb-based +Any route created by any of the HTTP-verb-based route methods will also be inaccessible from the CLI, but routes created by the ``add()`` method will still be -available from the command line: +available from the command line. + +You can create routes that work only from the command-line, and are inaccessible from the web browser, with the +``cli()`` method: .. literalinclude:: routing/032.php From 2f16b45da33b0feef17d0da5c867de1fd3ae0f81 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 10:25:27 +0900 Subject: [PATCH 188/237] test: update test --- tests/system/Test/FeatureTestTraitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 33a29d522f47..6cebdae1a50a 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -325,7 +325,7 @@ public function provideRoutesData() public function testOpenCliRoutesFromHttpGot404($from, $to, $httpGet) { $this->expectException(PageNotFoundException::class); - $this->expectExceptionMessage('Cannot access the controller in a CLI Route.'); + $this->expectExceptionMessage('Cannot access CLI Route: '); $collection = Services::routes(); $collection->setAutoRoute(true); From f96e13200e3c290862c6fb89f5c6e0454b1cc189 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 10:38:05 +0900 Subject: [PATCH 189/237] fix: prohibit CLI route with parameterized method --- system/Router/AutoRouter.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/system/Router/AutoRouter.php b/system/Router/AutoRouter.php index fb50f5a438fe..80af8b8d5347 100644 --- a/system/Router/AutoRouter.php +++ b/system/Router/AutoRouter.php @@ -133,6 +133,13 @@ public function getRoute(string $uri, string $httpVerb): array if (is_string($handler)) { $handler = strtolower($handler); + // Like $routes->cli('hello/(:segment)', 'Home::$1') + if (strpos($handler, '::$') !== false) { + throw new PageNotFoundException( + 'Cannot access CLI Route: ' . $uri + ); + } + if (strpos($handler, $controller . '::' . $methodName) === 0) { throw new PageNotFoundException( 'Cannot access CLI Route: ' . $uri From 6d2cefc60c01f52dbc86807ddd72692225295de6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 11:40:00 +0900 Subject: [PATCH 190/237] fix: $cliRoutes contains only CLI routes, not '*' routes --- system/Router/AutoRouter.php | 2 +- system/Router/RouteCollection.php | 10 ++++++++-- system/Router/Router.php | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/system/Router/AutoRouter.php b/system/Router/AutoRouter.php index 80af8b8d5347..1475def4fb53 100644 --- a/system/Router/AutoRouter.php +++ b/system/Router/AutoRouter.php @@ -20,7 +20,7 @@ final class AutoRouter implements AutoRouterInterface { /** - * List of CLI routes. + * List of CLI routes that do not contain '*' routes. * * @var array [routeKey => handler] */ diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 3f728da77ce3..4daf43cabb3f 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -484,8 +484,10 @@ public function shouldAutoRoute(): bool /** * Returns the raw array of available routes. + * + * @param bool $only Whether to return without '*' routes. */ - public function getRoutes(?string $verb = null): array + public function getRoutes(?string $verb = null, bool $only = false): array { if (empty($verb)) { $verb = $this->getHTTPVerb(); @@ -501,7 +503,11 @@ public function getRoutes(?string $verb = null): array if (isset($this->routes[$verb])) { // Keep current verb's routes at the beginning, so they're matched // before any of the generic, "add" routes. - $collection = $this->routes[$verb] + ($this->routes['*'] ?? []); + if (! $only) { + $collection = $this->routes[$verb] + ($this->routes['*'] ?? []); + } else { + $collection = $this->routes[$verb]; + } foreach ($collection as $r) { $key = key($r['route']); diff --git a/system/Router/Router.php b/system/Router/Router.php index 6d01de217e20..6c024e61f28f 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -145,7 +145,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request ); } else { $this->autoRouter = new AutoRouter( - $this->collection->getRoutes('cli'), // @phpstan-ignore-line + $this->collection->getRoutes('cli', true), // @phpstan-ignore-line $this->collection->getDefaultNamespace(), $this->collection->getDefaultController(), $this->collection->getDefaultMethod(), From 9c62817dca2d379e5f95e8567590acbec3bcd312 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 13:32:53 +0900 Subject: [PATCH 191/237] refactor: remove `if` --- system/Router/RouteCollection.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 4daf43cabb3f..440f23cc0269 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -503,11 +503,7 @@ public function getRoutes(?string $verb = null, bool $only = false): array if (isset($this->routes[$verb])) { // Keep current verb's routes at the beginning, so they're matched // before any of the generic, "add" routes. - if (! $only) { - $collection = $this->routes[$verb] + ($this->routes['*'] ?? []); - } else { - $collection = $this->routes[$verb]; - } + $collection = ! $only ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb]; foreach ($collection as $r) { $key = key($r['route']); From a70eafb4caf794f1dd3a667595d55ef0091c817c Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 10 Jul 2023 09:41:31 +0900 Subject: [PATCH 192/237] docs: add changelog --- user_guide_src/source/changelogs/v4.3.7.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst index 47fc19f161d1..c35d8e4e6182 100644 --- a/user_guide_src/source/changelogs/v4.3.7.rst +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -12,6 +12,10 @@ Release Date: Unreleased BREAKING ******** +- **RouteCollection:** The second parameter ``bool $only = false`` has been added + to the ``RouteCollection::getRoutes()`` method. +- **AutoRouting Legacy:** The first parameter of the ``AutoRouter::__construct()`` + has been changed from ``$protectedControllers`` to ``$cliRoutes``. - **FeatureTestTrait:** When using :ref:`withBodyFormat() `, the priority of the request body has been changed. See :ref:`Upgrading Guide ` for details. @@ -28,6 +32,10 @@ Deprecations Bugs Fixed ********** +- **AutoRouting Legacy:** Fixed a bug that when you added a route with + ``$routes->add()``, the controller's other methods were inaccessible from the + web browser. + See the repo's `CHANGELOG.md `_ for a complete list of bugs fixed. From bed018a6742bf129bfb199ae1404a00410b044df Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 12 Jul 2023 13:19:01 +0900 Subject: [PATCH 193/237] refactor: improve parameter name --- system/Router/RouteCollection.php | 6 +++--- system/Router/Router.php | 2 +- user_guide_src/source/changelogs/v4.3.7.rst | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 440f23cc0269..488315193454 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -485,9 +485,9 @@ public function shouldAutoRoute(): bool /** * Returns the raw array of available routes. * - * @param bool $only Whether to return without '*' routes. + * @param bool $includeWildcard Whether to include '*' routes. */ - public function getRoutes(?string $verb = null, bool $only = false): array + public function getRoutes(?string $verb = null, bool $includeWildcard = true): array { if (empty($verb)) { $verb = $this->getHTTPVerb(); @@ -503,7 +503,7 @@ public function getRoutes(?string $verb = null, bool $only = false): array if (isset($this->routes[$verb])) { // Keep current verb's routes at the beginning, so they're matched // before any of the generic, "add" routes. - $collection = ! $only ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb]; + $collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb]; foreach ($collection as $r) { $key = key($r['route']); diff --git a/system/Router/Router.php b/system/Router/Router.php index 6c024e61f28f..f0b9d2c9aab5 100644 --- a/system/Router/Router.php +++ b/system/Router/Router.php @@ -145,7 +145,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request ); } else { $this->autoRouter = new AutoRouter( - $this->collection->getRoutes('cli', true), // @phpstan-ignore-line + $this->collection->getRoutes('cli', false), // @phpstan-ignore-line $this->collection->getDefaultNamespace(), $this->collection->getDefaultController(), $this->collection->getDefaultMethod(), diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst index c35d8e4e6182..01ffae52ab5d 100644 --- a/user_guide_src/source/changelogs/v4.3.7.rst +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -12,8 +12,8 @@ Release Date: Unreleased BREAKING ******** -- **RouteCollection:** The second parameter ``bool $only = false`` has been added - to the ``RouteCollection::getRoutes()`` method. +- **RouteCollection:** The second parameter ``bool $includeWildcard = true`` has + been added to the ``RouteCollection::getRoutes()`` method. - **AutoRouting Legacy:** The first parameter of the ``AutoRouter::__construct()`` has been changed from ``$protectedControllers`` to ``$cliRoutes``. - **FeatureTestTrait:** When using :ref:`withBodyFormat() `, From 03cbbdb59fbc25eba5f0dadb2054fc1cbb319b40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:38:21 +0000 Subject: [PATCH 194/237] build(deps-dev): update rector/rector requirement from 0.17.3 to 0.17.5 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.3...0.17.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5eb5760d6142..ad742c57ec99 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.17.3", + "rector/rector": "0.17.5", "vimeo/psalm": "^5.0" }, "suggest": { From 998eb53916d6d985a2452e7daec934956bc11bdd Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 10:55:50 +0900 Subject: [PATCH 195/237] docs: remove Migrate controller sample It is not recommended to use a controller for migration. Using CLI is recommended. --- user_guide_src/source/dbmgmt/migration.rst | 17 ++++------------ .../source/dbmgmt/migration/005.php | 20 ------------------- 2 files changed, 4 insertions(+), 33 deletions(-) delete mode 100644 user_guide_src/source/dbmgmt/migration/005.php diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 616f782dce01..197e42d4a557 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -9,9 +9,9 @@ need to go and run them. You would also have to keep track of which changes need to be run against the production machines next time you deploy. The database table **migrations** tracks which migrations have already been -run so all you have to do is make sure your migrations are in place and -call ``$migration->latest()`` to bring the database up to the most recent -state. You can also use ``$migration->setNamespace(null)->latest()`` to +run, so all you have to do is make sure your migrations are in place and +run the ``spark migrate`` command to bring the database up to the most recent +state. You can also use ``spark migrate --all`` to include migrations from all namespaces. .. contents:: @@ -94,15 +94,6 @@ This will look for any migrations located at both **APPPATH/Database/Migrations* **ROOTPATH/MyCompany/Database/Migrations**. This makes it simple to include migrations in your re-usable, modular code suites. -************* -Usage Example -************* - -In this example some simple code is placed in **app/Controllers/Migrate.php** -to update the schema: - -.. literalinclude:: migration/005.php - .. _command-line-tools: ******************* @@ -110,7 +101,7 @@ Command-Line Tools ******************* CodeIgniter ships with several :doc:`commands ` that are available from the command line to help -you work with migrations. These tools are not required to use migrations but might make things easier for those of you +you work with migrations. These tools make things easier for those of you that wish to use them. The tools primarily provide access to the same methods that are available within the MigrationRunner class. migrate diff --git a/user_guide_src/source/dbmgmt/migration/005.php b/user_guide_src/source/dbmgmt/migration/005.php deleted file mode 100644 index e9b4c2ad37fe..000000000000 --- a/user_guide_src/source/dbmgmt/migration/005.php +++ /dev/null @@ -1,20 +0,0 @@ -latest(); - } catch (Throwable $e) { - // Do something with the error here... - } - } -} From f203918d7776777d8b8c44e19ad7c95aa9de41c1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 10:58:57 +0900 Subject: [PATCH 196/237] docs: add "..." to command output --- user_guide_src/source/dbmgmt/migration.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 197e42d4a557..59fad21b2415 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -162,6 +162,9 @@ status Displays a list of all migrations and the date and time they ran, or '--' if they have not been run:: > php spark migrate:status + + ... + +----------------------+-------------------+-----------------------+---------+---------------------+-------+ | Namespace | Version | Filename | Group | Migrated On | Batch | +----------------------+-------------------+-----------------------+---------+---------------------+-------+ From 5624e4bf37df08eec87817127cfd48a123a29d43 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 10:59:15 +0900 Subject: [PATCH 197/237] docs: separate options for database sessions --- user_guide_src/source/dbmgmt/migration.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 59fad21b2415..4a2f6229335f 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -188,13 +188,17 @@ creates is the Pascal case version of the filename. > php spark make:migration [options] -You can use (make:migration) with the following options: +You can use (``make:migration``) with the following options: + +- ``--namespace`` - Set root namespace. Default: ``APP_NAMESPACE``. +- ``--suffix`` - Append the component title to the class name. + +The following options are also available to generate the migration file for +database sessions: - ``--session`` - Generates the migration file for database sessions. - ``--table`` - Table name to use for database sessions. Default: ``ci_sessions``. - ``--dbgroup`` - Database group to use for database sessions. Default: ``default``. -- ``--namespace`` - Set root namespace. Default: ``APP_NAMESPACE``. -- ``--suffix`` - Append the component title to the class name. ********************* Migration Preferences From a634472b22298023cefe1a45016849d76514bc75 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 11:01:35 +0900 Subject: [PATCH 198/237] docs: fix text decoration --- user_guide_src/source/dbmgmt/migration.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/dbmgmt/migration.rst b/user_guide_src/source/dbmgmt/migration.rst index 4a2f6229335f..ccb2827e9947 100644 --- a/user_guide_src/source/dbmgmt/migration.rst +++ b/user_guide_src/source/dbmgmt/migration.rst @@ -227,7 +227,7 @@ Class Reference :returns: An array of migration files :rtype: array - An array of migration filenames are returned that are found in the **path** property. + An array of migration filenames are returned that are found in the ``path`` property. .. php:method:: latest($group) @@ -257,7 +257,7 @@ Class Reference :returns: ``true`` on success, ``false`` on failure :rtype: bool - This forces a single file to migrate regardless of order or batches. Method "up" or "down" is detected based on whether it has already been migrated. + This forces a single file to migrate regardless of order or batches. Method ``up()`` or ``down()`` is detected based on whether it has already been migrated. .. note:: This method is recommended only for testing and could cause data consistency issues. From 46a2703e6115fd7506c22df2649afecd8550701e Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 16:03:34 +0900 Subject: [PATCH 199/237] refactor: use new Paths() instead of config() `new Paths()` is faster than config(), and Paths is immutable. --- app/Config/Paths.php | 2 ++ system/Config/Services.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Config/Paths.php b/app/Config/Paths.php index e419477a51ec..01d5a8132db5 100644 --- a/app/Config/Paths.php +++ b/app/Config/Paths.php @@ -12,6 +12,8 @@ * share a system folder between multiple applications, and more. * * All paths are relative to the project's root folder. + * + * @immutable */ class Paths { diff --git a/system/Config/Services.php b/system/Config/Services.php index a47faf9c53ed..66d0532e5e47 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -461,7 +461,7 @@ public static function parser(?string $viewPath = null, ?ViewConfig $config = nu return static::getSharedInstance('parser', $viewPath, $config); } - $viewPath = $viewPath ?: config(Paths::class)->viewDirectory; + $viewPath = $viewPath ?: (new Paths())->viewDirectory; $config ??= config(ViewConfig::class); return new Parser($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger()); @@ -480,7 +480,7 @@ public static function renderer(?string $viewPath = null, ?ViewConfig $config = return static::getSharedInstance('renderer', $viewPath, $config); } - $viewPath = $viewPath ?: config(Paths::class)->viewDirectory; + $viewPath = $viewPath ?: (new Paths())->viewDirectory; $config ??= config(ViewConfig::class); return new View($config, $viewPath, AppServices::locator(), CI_DEBUG, AppServices::logger()); From cdf6b225f4ec426342ff184b97f98048b2d6ac35 Mon Sep 17 00:00:00 2001 From: Stefan Bauer Date: Thu, 13 Jul 2023 09:12:38 +0200 Subject: [PATCH 200/237] Update number_helper.php --- system/Helpers/number_helper.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 5f0e59232fb3..0b7c22b0c959 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -69,7 +69,9 @@ function number_to_size($num, int $precision = 1, ?string $locale = null) * * @see https://simple.wikipedia.org/wiki/Names_for_large_numbers * - * @param int|string $num + * @param int|string $num Will be cast as int + * @param int $precision [optional] The optional number of decimal digits to round to. + * @param string $locale [optional] * * @return bool|string */ @@ -91,19 +93,19 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null) $generalLocale = substr($locale, 0, $underscorePos); } - if ($num > 1_000_000_000_000_000) { + if ($num >= 1_000_000_000_000_000) { $suffix = lang('Number.quadrillion', [], $generalLocale); $num = round(($num / 1_000_000_000_000_000), $precision); - } elseif ($num > 1_000_000_000_000) { + } elseif ($num >= 1_000_000_000_000) { $suffix = lang('Number.trillion', [], $generalLocale); $num = round(($num / 1_000_000_000_000), $precision); - } elseif ($num > 1_000_000_000) { + } elseif ($num >= 1_000_000_000) { $suffix = lang('Number.billion', [], $generalLocale); $num = round(($num / 1_000_000_000), $precision); - } elseif ($num > 1_000_000) { + } elseif ($num >= 1_000_000) { $suffix = lang('Number.million', [], $generalLocale); $num = round(($num / 1_000_000), $precision); - } elseif ($num > 1000) { + } elseif ($num >= 1000) { $suffix = lang('Number.thousand', [], $generalLocale); $num = round(($num / 1000), $precision); } From 0af3f73a33b8c4f14b5a16a55b2f8d7a04263c3a Mon Sep 17 00:00:00 2001 From: Stefan Bauer Date: Thu, 13 Jul 2023 09:13:47 +0200 Subject: [PATCH 201/237] Update NumberHelperTest.php --- tests/system/Helpers/NumberHelperTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/system/Helpers/NumberHelperTest.php b/tests/system/Helpers/NumberHelperTest.php index 84f05607d4a3..b9faed213888 100755 --- a/tests/system/Helpers/NumberHelperTest.php +++ b/tests/system/Helpers/NumberHelperTest.php @@ -101,26 +101,45 @@ public function testTbFormat() public function testThousands() { $this->assertSame('123 thousand', number_to_amount('123,000', 0, 'en_US')); + $this->assertSame('1 thousand', number_to_amount('1000', 0, 'en_US')); + $this->assertSame('999 thousand', number_to_amount('999499', 0, 'en_US')); + $this->assertSame('1,000 thousand', number_to_amount('999500', 0, 'en_US')); + $this->assertSame('1,000 thousand', number_to_amount('999999', 0, 'en_US')); } public function testMillions() { $this->assertSame('123.4 million', number_to_amount('123,400,000', 1, 'en_US')); + $this->assertSame('1 million', number_to_amount('1,000,000', 1, 'en_US')); + $this->assertSame('1.5 million', number_to_amount('1,499,999', 1, 'en_US')); + $this->assertSame('1.5 million', number_to_amount('1,500,000', 1, 'en_US')); + $this->assertSame('1.5 million', number_to_amount('1,549,999', 1, 'en_US')); + $this->assertSame('1.6 million', number_to_amount('1,550,000', 1, 'en_US')); + $this->assertSame('999.5 million', number_to_amount('999,500,000', 1, 'en_US')); + $this->assertSame('1,000 million', number_to_amount('999,500,000', 0, 'en_US')); + $this->assertSame('1,000 million', number_to_amount('999,999,999', 1, 'en_US')); } public function testBillions() { $this->assertSame('123.46 billion', number_to_amount('123,456,000,000', 2, 'en_US')); + $this->assertSame('1 billion', number_to_amount('1,000,000,000', 2, 'en_US')); + $this->assertSame('1,000 billion', number_to_amount('999,999,999,999', 2, 'en_US')); } public function testTrillions() { $this->assertSame('123.457 trillion', number_to_amount('123,456,700,000,000', 3, 'en_US')); + $this->assertSame('1 trillion', number_to_amount('1,000,000,000,000', 3, 'en_US')); + $this->assertSame('1,000 trillion', number_to_amount('999,999,999,999,999', 3, 'en_US')); } public function testQuadrillions() { $this->assertSame('123.5 quadrillion', number_to_amount('123,456,700,000,000,000', 1, 'en_US')); + $this->assertSame('1 quadrillion', number_to_amount('1,000,000,000,000,000', 0, 'en_US')); + $this->assertSame('1,000 quadrillion', number_to_amount('999,999,999,999,999,999', 0, 'en_US')); + $this->assertSame('1,000 quadrillion', number_to_amount('1,000,000,000,000,000,000', 0, 'en_US')); } public function testCurrencyCurrentLocale() From 254435e8eb20466f93c1a589496f47cc4b53c218 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 16:14:59 +0900 Subject: [PATCH 202/237] docs: add notes --- app/Config/Autoload.php | 5 ++++- app/Config/Modules.php | 5 +++++ app/Config/Paths.php | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index abd9df9dfd72..e9ee6613d22b 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -13,7 +13,10 @@ * can find the files as needed. * * NOTE: If you use an identical key in $psr4 or $classmap, then - * the values in this file will overwrite the framework's values. + * the values in this file will overwrite the framework's values. + * + * NOTE: This class is required prior to Autoloader instantiation, + * and does not extend BaseConfig. */ class Autoload extends AutoloadConfig { diff --git a/app/Config/Modules.php b/app/Config/Modules.php index 5b6a639b3957..7e4916dd8f5b 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -4,6 +4,11 @@ use CodeIgniter\Modules\Modules as BaseModules; +/** + * Modules Configuration. + * + * NOTE: This class is required prior to Autoloader instantiation. + */ class Modules extends BaseModules { /** diff --git a/app/Config/Paths.php b/app/Config/Paths.php index 01d5a8132db5..262c745ffa95 100644 --- a/app/Config/Paths.php +++ b/app/Config/Paths.php @@ -13,6 +13,9 @@ * * All paths are relative to the project's root folder. * + * NOTE: This class is required prior to Autoloader instantiation, + * and does not extend BaseConfig. + * * @immutable */ class Paths From e25fe3d1963c9cc54b3f2552d726abf5374d6208 Mon Sep 17 00:00:00 2001 From: Stefan Bauer Date: Thu, 13 Jul 2023 09:16:01 +0200 Subject: [PATCH 203/237] Update v4.3.7.rst --- user_guide_src/source/changelogs/v4.3.7.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.3.7.rst b/user_guide_src/source/changelogs/v4.3.7.rst index 47fc19f161d1..59939bc8ec3b 100644 --- a/user_guide_src/source/changelogs/v4.3.7.rst +++ b/user_guide_src/source/changelogs/v4.3.7.rst @@ -22,6 +22,10 @@ Message Changes Changes ******* +- The number helper function :php:func:`number_to_amount()`, which previously + returned "1000", has been corrected to return "1 thousand" when the number + is exactly 1000, for example. + Deprecations ************ From a2fed684946a02ce0df7e59d832ed62db7d5292c Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 16:15:36 +0900 Subject: [PATCH 204/237] docs: replace Note: with NOTE: For concisytency. --- app/Config/Cache.php | 3 ++- app/Config/ContentSecurityPolicy.php | 2 +- app/Config/Logger.php | 2 +- app/Config/Migrations.php | 2 +- app/Config/Modules.php | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Config/Cache.php b/app/Config/Cache.php index c19358ce8449..5ba93328110f 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -95,7 +95,8 @@ class Cache extends BaseConfig * A string of reserved characters that will not be allowed in keys or tags. * Strings that violate this restriction will cause handlers to throw. * Default: {}()/\@: - * Note: The default set is required for PSR-6 compliance. + * + * NOTE: The default set is required for PSR-6 compliance. */ public string $reservedCharacters = '{}()/\@:'; diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 18612e15cc37..7799c476f078 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -39,7 +39,7 @@ class ContentSecurityPolicy extends BaseConfig // ------------------------------------------------------------------------- // Sources allowed - // Note: once you set a policy to 'none', it cannot be further restricted + // NOTE: once you set a policy to 'none', it cannot be further restricted // ------------------------------------------------------------------------- /** diff --git a/app/Config/Logger.php b/app/Config/Logger.php index 7c7414d47228..3fb341c6c04f 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -99,7 +99,7 @@ class Logger extends BaseConfig * An extension of 'php' allows for protecting the log files via basic * scripting, when they are to be stored under a publicly accessible directory. * - * Note: Leaving it blank will default to 'log'. + * NOTE: Leaving it blank will default to 'log'. */ 'fileExtension' => '', diff --git a/app/Config/Migrations.php b/app/Config/Migrations.php index af28e8ef508a..3c825667cf69 100644 --- a/app/Config/Migrations.php +++ b/app/Config/Migrations.php @@ -40,7 +40,7 @@ class Migrations extends BaseConfig * using the CLI command: * > php spark make:migration * - * Note: if you set an unsupported format, migration runner will not find + * NOTE: if you set an unsupported format, migration runner will not find * your migration files. * * Supported formats: diff --git a/app/Config/Modules.php b/app/Config/Modules.php index 7e4916dd8f5b..54079e771f29 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -7,7 +7,8 @@ /** * Modules Configuration. * - * NOTE: This class is required prior to Autoloader instantiation. + * NOTE: This class is required prior to Autoloader instantiation, + * and does not extend BaseConfig. */ class Modules extends BaseModules { From 60b76e8834cfcfcc0a5014a22a2be211df8f6697 Mon Sep 17 00:00:00 2001 From: Stefan Bauer Date: Thu, 13 Jul 2023 11:11:55 +0200 Subject: [PATCH 205/237] Update number_helper.php Optional nullable parameter in PHPDoc --- system/Helpers/number_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Helpers/number_helper.php b/system/Helpers/number_helper.php index 0b7c22b0c959..07d3be942cf5 100644 --- a/system/Helpers/number_helper.php +++ b/system/Helpers/number_helper.php @@ -69,9 +69,9 @@ function number_to_size($num, int $precision = 1, ?string $locale = null) * * @see https://simple.wikipedia.org/wiki/Names_for_large_numbers * - * @param int|string $num Will be cast as int - * @param int $precision [optional] The optional number of decimal digits to round to. - * @param string $locale [optional] + * @param int|string $num Will be cast as int + * @param int $precision [optional] The optional number of decimal digits to round to. + * @param string|null $locale [optional] * * @return bool|string */ From 137f6d6607327e5606b2d77e3ed98595a377e176 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 13 Jul 2023 22:06:16 +0900 Subject: [PATCH 206/237] docs: update 404 links --- user_guide_src/source/testing/overview.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/testing/overview.rst b/user_guide_src/source/testing/overview.rst index 41ececd1b2d4..653150c28d7c 100644 --- a/user_guide_src/source/testing/overview.rst +++ b/user_guide_src/source/testing/overview.rst @@ -150,7 +150,7 @@ Ensure that a header or cookie was actually emitted: .. literalinclude:: overview/009.php .. note:: the test case with this should be `run as a separate process - in PHPunit `_. + in PHPunit `_. assertHeaderNotEmitted($header, $ignoreCase = false) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,7 +160,7 @@ Ensure that a header or cookie was not emitted: .. literalinclude:: overview/010.php .. note:: the test case with this should be `run as a separate process - in PHPunit `_. + in PHPunit `_. assertCloseEnough($expected, $actual, $message = '', $tolerance = 1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From eaf0cffd8dc7c946e3f5355c38fa4fe2c553478f Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 14 Jul 2023 15:40:40 +0900 Subject: [PATCH 207/237] docs: improve warning --- user_guide_src/source/general/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index f6214e6397c3..2e666c8245c8 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -122,7 +122,7 @@ The loaded environment variables are accessed using any of the following: .. literalinclude:: configuration/005.php -.. warning:: Note that your settings from the **.env** file are added to Environment Variables. As a side effect, this means that if your CodeIgniter application is (for example) generating a ``var_dump($_ENV)`` or ``phpinfo()`` (for debugging or other valid reasons) **your secure credentials are publicly exposed**. +.. warning:: Note that your settings from the **.env** file are added to ``$_SERVER`` and ``$_ENV``. As a side effect, this means that if your CodeIgniter application is (for example) generating a ``var_dump($_ENV)`` or ``phpinfo()`` (for debugging or other valid reasons), or a detailed error report in the ``development`` environment is shown, **your secure credentials are publicly exposed**. Nesting Variables ----------------- From 38a6c977dbde8096457159b39b8bfdcb7acdfb13 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 14 Jul 2023 15:41:10 +0900 Subject: [PATCH 208/237] docs: improve description --- user_guide_src/source/general/errors.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 6d6ddeb51e77..6273038bd0b1 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -3,9 +3,11 @@ Error Handling ############## CodeIgniter builds error reporting into your system through Exceptions, both the `SPL collection `_, as -well as a few custom exceptions that are provided by the framework. Depending on your environment's setup, +well as a few exceptions that are provided by the framework. + +Depending on your environment's setup, the default action when an error or exception is thrown is to display a detailed error report unless the application -is running under the ``production`` environment. In this case, a more generic message is displayed to +is running under the ``production`` environment. In the ``production`` environment, a more generic message is displayed to keep the best user experience for your users. .. contents:: From 5381d501525036aedbe84e135f81e405199efa59 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 14 Jul 2023 15:41:34 +0900 Subject: [PATCH 209/237] docs: add sub section title and improve description --- user_guide_src/source/general/errors.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 6273038bd0b1..609b2109dae3 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -45,7 +45,10 @@ the error handler to function as normal, you can throw a new exception within th Configuration ============= -By default, CodeIgniter will display all errors in the ``development`` and ``testing`` environments, and will not +Error Reporting +--------------- + +By default, CodeIgniter will display a detailed error report with all errors in the ``development`` and ``testing`` environments, and will not display any errors in the ``production`` environment. You can change this by setting the ``CI_ENVIRONMENT`` variable in the **.env** file. From b924bf4dd5d4d8e742a7eeaae5ed6efa91cf3d20 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 14 Jul 2023 15:42:11 +0900 Subject: [PATCH 210/237] docs: add warning --- user_guide_src/source/general/errors.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 609b2109dae3..8a75871343b8 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -54,6 +54,10 @@ in the **.env** file. .. important:: Disabling error reporting DOES NOT stop logs from being written if there are errors. +.. warning:: Note that your settings from the **.env** file are added to ``$_SERVER`` + and ``$_ENV``. As a side effect, this means that if the detailed error report + is displayed, **your secure credentials are publicly exposed**. + Logging Exceptions ------------------ From 69dad6e3c01d2571f9cc5bf1599399987bc44b12 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 14 Jul 2023 15:43:56 +0900 Subject: [PATCH 211/237] docs: add link to other page --- user_guide_src/source/general/errors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst index 8a75871343b8..73f737671243 100644 --- a/user_guide_src/source/general/errors.rst +++ b/user_guide_src/source/general/errors.rst @@ -50,7 +50,7 @@ Error Reporting By default, CodeIgniter will display a detailed error report with all errors in the ``development`` and ``testing`` environments, and will not display any errors in the ``production`` environment. You can change this by setting the ``CI_ENVIRONMENT`` variable -in the **.env** file. +in the :ref:`.env ` file. .. important:: Disabling error reporting DOES NOT stop logs from being written if there are errors. From f4225d20fe1ba72c72265ccbf200497e77e56f3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:27:02 +0000 Subject: [PATCH 212/237] build(deps-dev): update rector/rector requirement from 0.17.5 to 0.17.6 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.5...0.17.6) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ad742c57ec99..996b6d9ed5b5 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.17.5", + "rector/rector": "0.17.6", "vimeo/psalm": "^5.0" }, "suggest": { From eb39818489a04ef375533683661c11026ec37db0 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 18 Jul 2023 05:02:40 +0700 Subject: [PATCH 213/237] [Rector] Enable skipped GetMockBuilderGetMockToCreateMockRector on EmailTest.php --- rector.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rector.php b/rector.php index df51a9b43b5a..c8e18dfd2096 100644 --- a/rector.php +++ b/rector.php @@ -39,7 +39,6 @@ use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; use Rector\PHPUnit\Rector\MethodCall\AssertPropertyExistsRector; -use Rector\PHPUnit\Rector\MethodCall\GetMockBuilderGetMockToCreateMockRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Set\ValueObject\LevelSetList; @@ -108,11 +107,6 @@ // use mt_rand instead of random_int on purpose on non-cryptographically random RandomFunctionRector::class, - // @TODO remove if https://github.com/rectorphp/rector-phpunit/issues/86 is fixed - GetMockBuilderGetMockToCreateMockRector::class => [ - __DIR__ . '/tests/system/Email/EmailTest.php', - ], - SimplifyRegexPatternRector::class, ]); From 00c7086d7d380d9be31c5f808df5cc37ab793218 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 18 Jul 2023 17:25:10 +0800 Subject: [PATCH 214/237] Adjust registering of custom fixers for PHP 8.0+ only --- .php-cs-fixer.dist.php | 21 ++++++++++++++------- .php-cs-fixer.no-header.php | 21 ++++++++++++++------- .php-cs-fixer.user-guide.php | 21 ++++++++++++++------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b2f86c686252..3653cf1349c2 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -46,16 +46,23 @@ $overrides = []; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.cache', - 'finder' => $finder, - 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), - 'customRules' => [ - NoCodeSeparatorCommentFixer::name() => true, - ], + 'cacheFile' => 'build/.php-cs-fixer.cache', + 'finder' => $finder, ]; -return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( +$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter 4 framework', 'CodeIgniter Foundation', 'admin@codeigniter.com' ); + +// @TODO: remove this check when support for PHP 7.4 is dropped +if (PHP_VERSION_ID >= 80000) { + $config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); +} + +return $config; diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index cd10717aa5a2..7c9ae1e80737 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -32,12 +32,19 @@ $overrides = []; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', - 'finder' => $finder, - 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), - 'customRules' => [ - NoCodeSeparatorCommentFixer::name() => true, - ], + 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', + 'finder' => $finder, ]; -return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); +$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); + +// @TODO: remove this check when support for PHP 7.4 is dropped +if (PHP_VERSION_ID >= 80000) { + $config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); +} + +return $config; diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 1fa41bc4fb42..a3ae78a48232 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -36,12 +36,19 @@ ]; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.user-guide.cache', - 'finder' => $finder, - 'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'), - 'customRules' => [ - NoCodeSeparatorCommentFixer::name() => true, - ], + 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', + 'finder' => $finder, ]; -return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); +$config = Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects(); + +// @TODO: remove this check when support for PHP 7.4 is dropped +if (PHP_VERSION_ID >= 80000) { + $config + ->registerCustomFixers(FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')) + ->setRules(array_merge($config->getRules(), [ + NoCodeSeparatorCommentFixer::name() => true, + ])); +} + +return $config; From ac87a1e094028f56f9dfa378173a9f50af94bf00 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 17 Jul 2023 16:30:13 +0800 Subject: [PATCH 215/237] Configure `php_unit_data_provider_return_type` fixer --- .php-cs-fixer.dist.php | 4 +- .php-cs-fixer.no-header.php | 4 +- .php-cs-fixer.user-guide.php | 9 ++-- tests/system/CLI/CLITest.php | 2 +- .../system/Cache/Handlers/BaseHandlerTest.php | 2 +- .../system/Cache/Handlers/FileHandlerTest.php | 2 +- tests/system/CodeIgniterTest.php | 2 +- tests/system/Commands/CommandTest.php | 2 +- .../Routes/SampleURIGeneratorTest.php | 3 +- tests/system/CommonFunctionsTest.php | 2 +- tests/system/Config/MimesTest.php | 4 +- tests/system/Cookie/CookieTest.php | 3 +- tests/system/Database/BaseConnectionTest.php | 3 +- tests/system/Database/BaseQueryTest.php | 4 +- tests/system/Database/Builder/WhereTest.php | 4 +- tests/system/Database/ConfigTest.php | 3 +- tests/system/Email/EmailTest.php | 2 +- tests/system/Filters/FiltersTest.php | 2 +- tests/system/Filters/InvalidCharsTest.php | 4 +- tests/system/Format/XMLFormatterTest.php | 2 +- tests/system/HTTP/CLIRequestTest.php | 2 +- tests/system/HTTP/IncomingRequestTest.php | 7 ++-- tests/system/HTTP/MessageTest.php | 2 +- tests/system/HTTP/RequestTest.php | 2 +- tests/system/HTTP/ResponseTest.php | 4 +- tests/system/HTTP/URITest.php | 14 +++---- tests/system/Helpers/ArrayHelperTest.php | 4 +- tests/system/Helpers/InflectorHelperTest.php | 2 +- .../Helpers/URLHelper/CurrentUrlTest.php | 2 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 28 ++++++------- .../system/Helpers/URLHelper/SiteUrlTest.php | 2 +- tests/system/I18n/TimeLegacyTest.php | 3 +- tests/system/I18n/TimeTest.php | 3 +- tests/system/Language/LanguageTest.php | 2 +- tests/system/Models/UpdateModelTest.php | 3 +- .../Publisher/PublisherRestrictionsTest.php | 4 +- .../RouteCollectionReverseRouteTest.php | 3 +- tests/system/Router/RouteCollectionTest.php | 6 +-- tests/system/Router/RouterTest.php | 2 +- tests/system/Test/DOMParserTest.php | 2 +- tests/system/Test/FeatureTestTraitTest.php | 2 +- tests/system/Test/TestResponseTest.php | 2 +- tests/system/Throttle/ThrottleTest.php | 2 +- .../system/Validation/CreditCardRulesTest.php | 3 +- tests/system/Validation/FormatRulesTest.php | 42 +++++++++---------- tests/system/Validation/RulesTest.php | 39 +++++++++-------- .../StrictRules/CreditCardRulesTest.php | 3 +- .../Validation/StrictRules/RulesTest.php | 11 +++-- tests/system/Validation/ValidationTest.php | 11 +++-- tests/system/View/ParserTest.php | 2 +- 50 files changed, 134 insertions(+), 143 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 3653cf1349c2..928f5b801071 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -43,7 +43,9 @@ __DIR__ . '/spark', ]); -$overrides = []; +$overrides = [ + 'php_unit_data_provider_return_type' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.cache', diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 7c9ae1e80737..954a06ec0230 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -29,7 +29,9 @@ __DIR__ . '/admin/starter/builds', ]); -$overrides = []; +$overrides = [ + 'php_unit_data_provider_return_type' => true, +]; $options = [ 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index a3ae78a48232..c15d0dcca006 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -29,10 +29,11 @@ ]); $overrides = [ - 'echo_tag_syntax' => false, - 'php_unit_internal_class' => false, - 'no_unused_imports' => false, - 'class_attributes_separation' => false, + 'echo_tag_syntax' => false, + 'php_unit_internal_class' => false, + 'no_unused_imports' => false, + 'class_attributes_separation' => false, + 'php_unit_data_provider_return_type' => true, ]; $options = [ diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 0e8ed4db73a3..3068328aa9a8 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -463,7 +463,7 @@ public function testTable($tbody, $thead, $expected) $this->assertSame($this->getStreamFilterBuffer(), $expected); } - public function tableProvider() + public function tableProvider(): iterable { $head = [ 'ID', diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index 9ece2ba2ddaf..ba1dd0b2491f 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -35,7 +35,7 @@ public function testValidateKeyInvalidType($input) BaseHandler::validateKey($input); } - public function invalidTypeProvider(): array + public function invalidTypeProvider(): iterable { return [ [true], diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 4f354495c81a..6f5e6b82f8c5 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -296,7 +296,7 @@ public function testSaveMode(int $int, string $string): void $this->assertSame($string, $mode); } - public function modeProvider() + public function modeProvider(): iterable { return [ [ diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 9d3343bfbaa1..ae88e6f2f3a1 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -789,7 +789,7 @@ public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $e CITestStreamFilter::removeErrorFilter(); } - public function cacheQueryStringProvider(): array + public function cacheQueryStringProvider(): iterable { $testingUrls = [ 'test', // URL #1 diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 23323933e5c9..1101e08ef5b6 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -138,7 +138,7 @@ public function testCommandParsesArgsCorrectly(string $input, array $expected) $this->assertSame($expected, ParamsReveal::$args); } - public function commandArgsProvider(): array + public function commandArgsProvider(): iterable { return [ [ diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index 4b7b8fa3e814..fe7bf12613a7 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Config\Services; use CodeIgniter\Test\CIUnitTestCase; -use Generator; /** * @internal @@ -34,7 +33,7 @@ public function testGet(string $routeKey, string $expected) $this->assertSame($expected, $uri); } - public function routeKeyProvider(): Generator + public function routeKeyProvider(): iterable { yield from [ 'root' => ['/', '/'], diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index a0b5280ec6bc..b304eeab69eb 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -604,7 +604,7 @@ public function testCleanPathActuallyCleaningThePaths($input, $expected) $this->assertSame($expected, clean_path($input)); } - public function dirtyPathsProvider() + public function dirtyPathsProvider(): iterable { $ds = DIRECTORY_SEPARATOR; diff --git a/tests/system/Config/MimesTest.php b/tests/system/Config/MimesTest.php index 4cbd09958238..1ff85dffefec 100644 --- a/tests/system/Config/MimesTest.php +++ b/tests/system/Config/MimesTest.php @@ -21,7 +21,7 @@ */ final class MimesTest extends CIUnitTestCase { - public function extensionsList() + public function extensionsList(): iterable { return [ 'null' => [ @@ -55,7 +55,7 @@ public function testGuessExtensionFromType(?string $expected, string $mime) $this->assertSame($expected, Mimes::guessExtensionFromType($mime)); } - public function mimesList() + public function mimesList(): iterable { return [ 'null' => [ diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index 86d01305d696..c69fb1b806d2 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -16,7 +16,6 @@ use Config\Cookie as CookieConfig; use DateTimeImmutable; use DateTimeZone; -use Generator; use LogicException; /** @@ -99,7 +98,7 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str $this->assertSame($expected, $cookie->getPrefixedName()); } - public function prefixProvider(): Generator + public function prefixProvider(): iterable { yield from [ ['prefix_', '', 'prefix_test'], diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 300e7f7fe5e0..ee59f55d6f2a 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -14,7 +14,6 @@ use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\Mock\MockConnection; -use Generator; use Throwable; /** @@ -184,7 +183,7 @@ public function testProtectIdentifiers( $this->assertSame($expected, $return); } - public function identifiersProvider(): Generator + public function identifiersProvider(): iterable { yield from [ // $prefixSingle, $protectIdentifiers, $fieldExists, $item, $expected diff --git a/tests/system/Database/BaseQueryTest.php b/tests/system/Database/BaseQueryTest.php index 273c52491c15..c25d1cefec69 100644 --- a/tests/system/Database/BaseQueryTest.php +++ b/tests/system/Database/BaseQueryTest.php @@ -104,7 +104,7 @@ public function testSwapPrefix() $this->assertSame($newSQL, $query->getQuery()); } - public function queryTypes() + public function queryTypes(): iterable { return [ 'select' => [ @@ -577,7 +577,7 @@ public function testSwapPrefixAfterGetQuery() $this->assertSame($expected, $query->getQuery()); } - public function queryKeywords() + public function queryKeywords(): iterable { return [ 'highlightKeyWords' => [ diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index b4a1b90a59f4..df0a778f3c39 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -392,7 +392,7 @@ public function testWhereInSubQuery() $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } - public function provideInvalidKeys() + public function provideInvalidKeys(): iterable { return [ 'null' => [null], @@ -413,7 +413,7 @@ public function testWhereInvalidKeyThrowInvalidArgumentException($key) $builder->whereIn($key, ['Politician', 'Accountant']); } - public function provideInvalidValues() + public function provideInvalidValues(): iterable { return [ 'null' => [null], diff --git a/tests/system/Database/ConfigTest.php b/tests/system/Database/ConfigTest.php index 3e963749dd57..31d2e54a8e9c 100644 --- a/tests/system/Database/ConfigTest.php +++ b/tests/system/Database/ConfigTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Test\ReflectionHelper; -use Generator; /** * @internal @@ -209,7 +208,7 @@ public function testConvertDSN(string $input, string $expected) $this->assertSame($expected, $this->getPrivateProperty($conn, 'DSN')); } - public function convertDSNProvider(): Generator + public function convertDSNProvider(): iterable { yield from [ [ diff --git a/tests/system/Email/EmailTest.php b/tests/system/Email/EmailTest.php index d329e60103d2..cff60c7f9e0b 100644 --- a/tests/system/Email/EmailTest.php +++ b/tests/system/Email/EmailTest.php @@ -32,7 +32,7 @@ public function testEmailValidation() $this->assertStringContainsString('Invalid email address: "invalid"', $email->printDebugger()); } - public function autoClearProvider() + public function autoClearProvider(): iterable { return [ 'autoclear' => [true], diff --git a/tests/system/Filters/FiltersTest.php b/tests/system/Filters/FiltersTest.php index f111f4b957f6..80bd9cbbf0ca 100644 --- a/tests/system/Filters/FiltersTest.php +++ b/tests/system/Filters/FiltersTest.php @@ -208,7 +208,7 @@ public function testProcessMethodProcessGlobals() $this->assertSame($expected, $filters->initialize()->getFilters()); } - public function provideExcept() + public function provideExcept(): iterable { return [ [ diff --git a/tests/system/Filters/InvalidCharsTest.php b/tests/system/Filters/InvalidCharsTest.php index becc601d816a..705d3bb70f0e 100644 --- a/tests/system/Filters/InvalidCharsTest.php +++ b/tests/system/Filters/InvalidCharsTest.php @@ -124,7 +124,7 @@ public function testCheckControlStringWithLineBreakAndTabReturnsTheString(string $this->invalidChars->before($this->request); } - public function stringWithLineBreakAndTabProvider() + public function stringWithLineBreakAndTabProvider(): iterable { yield from [ ["String contains \n line break."], @@ -148,7 +148,7 @@ public function testCheckControlStringWithControlCharsCausesException(string $in $this->invalidChars->before($this->request); } - public function stringWithControlCharsProvider() + public function stringWithControlCharsProvider(): iterable { yield from [ ["String contains null char.\0"], diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index c642d7e77eca..a97b108b088d 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -115,7 +115,7 @@ public function testValidatingInvalidTags(string $expected, array $input) $this->assertSame($expectedXML, $this->xmlFormatter->format($input)); } - public function invalidTagsProvider() + public function invalidTagsProvider(): iterable { return [ [ diff --git a/tests/system/HTTP/CLIRequestTest.php b/tests/system/HTTP/CLIRequestTest.php index 574a9f48c26d..69106adf2219 100644 --- a/tests/system/HTTP/CLIRequestTest.php +++ b/tests/system/HTTP/CLIRequestTest.php @@ -517,7 +517,7 @@ public function testFetchGlobalWithEmptyNotation() $this->assertSame($expected, $this->request->fetchGlobal('post', 'clients[]')); } - public function ipAddressChecks() + public function ipAddressChecks(): iterable { return [ 'empty' => [ diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index f6994f722ce9..b4ab3606ed8b 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -16,7 +16,6 @@ use CodeIgniter\HTTP\Files\UploadedFile; use CodeIgniter\Test\CIUnitTestCase; use Config\App; -use Generator; use InvalidArgumentException; use TypeError; @@ -519,7 +518,7 @@ public function testCanGrabGetRawInput() $this->assertSame($expected, $request->getRawInput()); } - public function provideRawInputVarChecks() + public function provideRawInputVarChecks(): iterable { return [ [ @@ -627,7 +626,7 @@ public function testIsHTTPMethodLowerCase(string $value) $this->assertTrue($request->is(strtolower($value))); } - public function provideIsHTTPMethods(): Generator + public function provideIsHTTPMethods(): iterable { yield from [ ['GET'], @@ -840,7 +839,7 @@ public function testGetPostIndexNotExists() $this->assertNull($this->request->getGetPost('gc')); } - public function providePathChecks() + public function providePathChecks(): iterable { return [ 'not /index.php' => [ diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index 8f96b267ad1e..86e870d3b073 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -185,7 +185,7 @@ public function testSetHeaderArrayValues() $this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept')); } - public function provideArrayHeaderValue() + public function provideArrayHeaderValue(): iterable { return [ 'existing for next not append' => [ diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index 17cf45078fe0..ab19f05adfac 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -532,7 +532,7 @@ public function testFetchGlobalFiltersWithArrayChildElement() $this->assertSame($expected, $this->request->fetchGlobal('post', 'people[0]', FILTER_VALIDATE_INT)); } - public function ipAddressChecks() + public function ipAddressChecks(): iterable { return [ 'empty' => [ diff --git a/tests/system/HTTP/ResponseTest.php b/tests/system/HTTP/ResponseTest.php index eb95ab3a33cc..ce320417748c 100644 --- a/tests/system/HTTP/ResponseTest.php +++ b/tests/system/HTTP/ResponseTest.php @@ -291,7 +291,7 @@ public function testRedirect( $this->assertSame($expectedCode, $response->getStatusCode()); } - public function provideForRedirect() + public function provideForRedirect(): iterable { yield from [ ['Apache/2.4.17', 'HTTP/1.1', 'GET', null, 302], @@ -337,7 +337,7 @@ public function testRedirectWithIIS( unset($_SERVER['SERVER_SOFTWARE']); } - public function provideForRedirectWithIIS() + public function provideForRedirectWithIIS(): iterable { yield from [ ['HTTP/1.1', 'GET', null, 302], diff --git a/tests/system/HTTP/URITest.php b/tests/system/HTTP/URITest.php index c9d6bb97f5d9..c65a363ac21e 100644 --- a/tests/system/HTTP/URITest.php +++ b/tests/system/HTTP/URITest.php @@ -136,7 +136,7 @@ public function testSimpleUri(string $url, string $expectedURL, string $expected $this->assertSame($expectedPath, $uri->getPath()); } - public function provideURLs(): array + public function provideURLs(): iterable { return [ '' => [ @@ -375,7 +375,7 @@ public function testSetPath(string $path, string $expectedURL, string $expectedP $this->assertSame($expectedPath, $uri->getPath()); } - public function providePaths(): array + public function providePaths(): iterable { return [ '' => [ @@ -431,7 +431,7 @@ public function providePaths(): array ]; } - public function invalidPaths() + public function invalidPaths(): iterable { return [ 'dot-segment' => [ @@ -555,7 +555,7 @@ public function testSetQueryThrowsErrorWhenFragmentPresentSilent() $this->assertSame('', $uri->getQuery()); } - public function authorityInfo() + public function authorityInfo(): iterable { return [ 'host-only' => [ @@ -590,7 +590,7 @@ public function testAuthorityReturnsExceptedValues($url, $expected) $this->assertSame($expected, $uri->getAuthority()); } - public function defaultPorts() + public function defaultPorts(): iterable { return [ 'http' => [ @@ -629,7 +629,7 @@ public function testSetAuthorityReconstitutes() $this->assertSame($authority, $uri->getAuthority()); } - public function defaultDots() + public function defaultDots(): iterable { return [ [ @@ -738,7 +738,7 @@ public function testRemoveDotSegments($path, $expected) $this->assertSame($expected, URI::removeDotSegments($path)); } - public function defaultResolutions() + public function defaultResolutions(): iterable { return [ [ diff --git a/tests/system/Helpers/ArrayHelperTest.php b/tests/system/Helpers/ArrayHelperTest.php index a2db5b06e7d7..0202c8c8bf3c 100644 --- a/tests/system/Helpers/ArrayHelperTest.php +++ b/tests/system/Helpers/ArrayHelperTest.php @@ -320,7 +320,7 @@ public function testArraySortByMultipleKeysFailsInconsistentArraySizes($data) array_sort_by_multiple_keys($data, $sortColumns); } - public static function deepSearchProvider() + public static function deepSearchProvider(): iterable { return [ [ @@ -346,7 +346,7 @@ public static function deepSearchProvider() ]; } - public static function sortByMultipleKeysProvider() + public static function sortByMultipleKeysProvider(): iterable { $seed = [ 0 => [ diff --git a/tests/system/Helpers/InflectorHelperTest.php b/tests/system/Helpers/InflectorHelperTest.php index 42b55b661787..53f4ecfb5e80 100755 --- a/tests/system/Helpers/InflectorHelperTest.php +++ b/tests/system/Helpers/InflectorHelperTest.php @@ -243,7 +243,7 @@ public function testDasherize() } } - public function provideOrdinal() + public function provideOrdinal(): iterable { return [ ['st', 1], diff --git a/tests/system/Helpers/URLHelper/CurrentUrlTest.php b/tests/system/Helpers/URLHelper/CurrentUrlTest.php index faee0608b54f..204a684aa857 100644 --- a/tests/system/Helpers/URLHelper/CurrentUrlTest.php +++ b/tests/system/Helpers/URLHelper/CurrentUrlTest.php @@ -235,7 +235,7 @@ public function testUriStringSubfolderRelative() $this->assertSame('assets/image.jpg', uri_string()); } - public function urlIsProvider() + public function urlIsProvider(): iterable { return [ [ diff --git a/tests/system/Helpers/URLHelper/MiscUrlTest.php b/tests/system/Helpers/URLHelper/MiscUrlTest.php index b943722d3908..af3869dcafee 100644 --- a/tests/system/Helpers/URLHelper/MiscUrlTest.php +++ b/tests/system/Helpers/URLHelper/MiscUrlTest.php @@ -112,7 +112,7 @@ public function testIndexPageAlt() // Test anchor - public function anchorNormalPatterns() + public function anchorNormalPatterns(): iterable { return [ 'normal01' => [ @@ -171,7 +171,7 @@ public function testAnchor($expected = '', $uri = '', $title = '', $attributes = $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorNoindexPatterns() + public function anchorNoindexPatterns(): iterable { return [ 'noindex01' => [ @@ -238,7 +238,7 @@ public function testAnchorNoindex($expected = '', $uri = '', $title = '', $attri $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorSubpagePatterns() + public function anchorSubpagePatterns(): iterable { return [ 'subpage01' => [ @@ -295,7 +295,7 @@ public function testAnchorTargetted($expected = '', $uri = '', $title = '', $att $this->assertSame($expected, anchor($uri, $title, $attributes, $this->config)); } - public function anchorExamplePatterns() + public function anchorExamplePatterns(): iterable { return [ 'egpage01' => [ @@ -341,7 +341,7 @@ public function testAnchorExamples($expected = '', $uri = '', $title = '', $attr // Test anchor_popup - public function anchorPopupPatterns() + public function anchorPopupPatterns(): iterable { return [ 'normal01' => [ @@ -399,7 +399,7 @@ public function testAnchorPopup($expected = '', $uri = '', $title = '', $attribu // Test mailto - public function mailtoPatterns() + public function mailtoPatterns(): iterable { return [ 'page01' => [ @@ -438,7 +438,7 @@ public function testMailto($expected = '', $email = '', $title = '', $attributes // Test safe_mailto - public function safeMailtoPatterns() + public function safeMailtoPatterns(): iterable { return [ 'page01' => [ @@ -487,7 +487,7 @@ public function testSafeMailtoWithCsp() // Test auto_link - public function autolinkUrls() + public function autolinkUrls(): iterable { return [ 'test01' => [ @@ -536,7 +536,7 @@ public function testAutoLinkUrl($in, $out) $this->assertSame($out, auto_link($in, 'url')); } - public function autolinkEmails() + public function autolinkEmails(): iterable { return [ 'test01' => [ @@ -585,7 +585,7 @@ public function testAutoLinkEmail($in, $out) $this->assertSame($out, auto_link($in, 'email')); } - public function autolinkBoth() + public function autolinkBoth(): iterable { return [ 'test01' => [ @@ -634,7 +634,7 @@ public function testAutolinkBoth($in, $out) $this->assertSame($out, auto_link($in)); } - public function autolinkPopup() + public function autolinkPopup(): iterable { return [ 'test01' => [ @@ -685,7 +685,7 @@ public function testAutoLinkPopup($in, $out) // Test prep_url - public function prepUrlProvider() + public function prepUrlProvider(): iterable { // input, expected, secure return [ @@ -854,7 +854,7 @@ public function testUrlToThrowsOnEmptyOrMissingRoute(string $route) url_to($route); } - public function urlToProvider() + public function urlToProvider(): iterable { $page = config('App')->indexPage !== '' ? config('App')->indexPage . '/' : ''; @@ -874,7 +874,7 @@ public function urlToProvider() ]; } - public function urlToMissingRoutesProvider() + public function urlToMissingRoutesProvider(): iterable { return [ [ diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index acc2643b75ab..6017f3047790 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -81,7 +81,7 @@ public function testUrls( $this->assertSame($expectedBaseUrl, base_url($path, $scheme)); } - public function configProvider() + public function configProvider(): iterable { // baseURL, indexPage, scheme, secure, path, expectedSiteUrl, expectedBaseUrl return [ diff --git a/tests/system/I18n/TimeLegacyTest.php b/tests/system/I18n/TimeLegacyTest.php index 8fb19f6582ce..281970a8aa9d 100644 --- a/tests/system/I18n/TimeLegacyTest.php +++ b/tests/system/I18n/TimeLegacyTest.php @@ -17,7 +17,6 @@ use Config\App; use DateTime; use DateTimeZone; -use Generator; use IntlDateFormatter; use Locale; @@ -1159,7 +1158,7 @@ public function testToStringDoesNotDependOnLocale(string $locale) $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): Generator + public function provideLocales(): iterable { yield from [ ['en'], diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index 8db1edd4207b..0b619600d550 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -17,7 +17,6 @@ use Config\App; use DateTime; use DateTimeZone; -use Generator; use IntlDateFormatter; use Locale; @@ -1171,7 +1170,7 @@ public function testToStringDoesNotDependOnLocale(string $locale) $this->assertSame('2017-03-10 12:00:00', (string) $time); } - public function provideLocales(): Generator + public function provideLocales(): iterable { yield from [ ['en'], diff --git a/tests/system/Language/LanguageTest.php b/tests/system/Language/LanguageTest.php index 8006ad6cf133..7f89baaa37b8 100644 --- a/tests/system/Language/LanguageTest.php +++ b/tests/system/Language/LanguageTest.php @@ -213,7 +213,7 @@ public function testPrioritizedLocator() $this->assertSame('billions and billions', lang('Core.bazillion', [], 'en')); } - public function MessageBundles() + public function MessageBundles(): iterable { return [ ['CLI'], diff --git a/tests/system/Models/UpdateModelTest.php b/tests/system/Models/UpdateModelTest.php index 7a32626aeb42..bd57025dc87f 100644 --- a/tests/system/Models/UpdateModelTest.php +++ b/tests/system/Models/UpdateModelTest.php @@ -14,7 +14,6 @@ use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Exceptions\DataException; use CodeIgniter\Entity\Entity; -use Generator; use InvalidArgumentException; use stdClass; use Tests\Support\Models\EventModel; @@ -398,7 +397,7 @@ public function testUpdateThrowDatabaseExceptionWithoutWhereClause($id, string $ $this->model->update($id, ['name' => 'Foo Bar']); } - public function provideInvalidIds(): Generator + public function provideInvalidIds(): iterable { yield from [ [ diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index 7c6c9788768b..f351a1791a73 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -69,7 +69,7 @@ public function testDefaultPublicRestrictions(string $path) $this->assertSame($expected, $errors[$file]->getMessage()); } - public function fileProvider() + public function fileProvider(): iterable { yield from [ 'php' => ['index.php'], @@ -99,7 +99,7 @@ public function testDestinations(string $destination, bool $allowed) $this->assertInstanceOf(Publisher::class, $publisher); } - public function destinationProvider() + public function destinationProvider(): iterable { return [ 'explicit' => [ diff --git a/tests/system/Router/RouteCollectionReverseRouteTest.php b/tests/system/Router/RouteCollectionReverseRouteTest.php index 2e6de5aacdf7..4f0e37c94c82 100644 --- a/tests/system/Router/RouteCollectionReverseRouteTest.php +++ b/tests/system/Router/RouteCollectionReverseRouteTest.php @@ -15,7 +15,6 @@ use CodeIgniter\Router\Exceptions\RouterException; use CodeIgniter\Test\CIUnitTestCase; use Config\Modules; -use Generator; /** * @internal @@ -121,7 +120,7 @@ public function testReverseRoutingWithLocale() $this->assertSame('/en/contact', $routes->reverseRoute('myController::goto')); } - public function reverseRoutingHandlerProvider(): Generator + public function reverseRoutingHandlerProvider(): iterable { return yield from [ 'Omit namespace' => ['Galleries::showUserGallery'], diff --git a/tests/system/Router/RouteCollectionTest.php b/tests/system/Router/RouteCollectionTest.php index 40c5da39b091..734420f73733 100644 --- a/tests/system/Router/RouteCollectionTest.php +++ b/tests/system/Router/RouteCollectionTest.php @@ -405,7 +405,7 @@ static function ($routes) { $this->assertSame($expected, $routes->getRoutes()); } - public function groupProvider() + public function groupProvider(): iterable { yield from [ ['admin', '/', [ @@ -1242,7 +1242,7 @@ static function () {}, $this->assertSame($options, $options1); } - public function optionsProvider() + public function optionsProvider(): iterable { yield from [ [ @@ -1657,7 +1657,7 @@ public function testZeroAsURIPath() $this->assertSame($expects, $router->handle('/0')); } - public function provideRouteDefaultNamespace() + public function provideRouteDefaultNamespace(): iterable { return [ 'with \\ prefix' => ['\App\Controllers'], diff --git a/tests/system/Router/RouterTest.php b/tests/system/Router/RouterTest.php index 5be01a47bfc6..1ba0ee9ed798 100644 --- a/tests/system/Router/RouterTest.php +++ b/tests/system/Router/RouterTest.php @@ -870,7 +870,7 @@ public function testRedirectRoute( $router->handle($url); } - public function provideRedirectCase(): array + public function provideRedirectCase(): iterable { // [$route, $redirectFrom, $redirectTo, $url, $expectedPath, $alias] return [ diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index c1ca8194f4b7..49d5e4b5d955 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -79,7 +79,7 @@ public function testParseSelectorWithAttribute() $this->assertSame(['href' => 'http://example.com'], $selector['attr']); } - public function provideText() + public function provideText(): iterable { return [ 'en' => ['Hello World'], diff --git a/tests/system/Test/FeatureTestTraitTest.php b/tests/system/Test/FeatureTestTraitTest.php index 6cebdae1a50a..e26776d1fb29 100644 --- a/tests/system/Test/FeatureTestTraitTest.php +++ b/tests/system/Test/FeatureTestTraitTest.php @@ -284,7 +284,7 @@ public function testCallZeroAsPathGot404() $this->get('0'); } - public function provideRoutesData() + public function provideRoutesData(): iterable { return [ 'non parameterized cli' => [ diff --git a/tests/system/Test/TestResponseTest.php b/tests/system/Test/TestResponseTest.php index 8abc71c6d9ed..63b7d9c7aa94 100644 --- a/tests/system/Test/TestResponseTest.php +++ b/tests/system/Test/TestResponseTest.php @@ -46,7 +46,7 @@ public function testIsOK(int $code, bool $isOk) /** * Provides status codes and their expected "OK" */ - public function statusCodeProvider(): array + public function statusCodeProvider(): iterable { return [ [ diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 2121636baefa..3bdd2e661224 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -208,7 +208,7 @@ public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $ } } - public function tokenTimeUsecases(): array + public function tokenTimeUsecases(): iterable { return [ '2 capacity / 200 seconds (100s refresh, 0.01 tokens/s) -> 5 checks, 1 cost each' => [ diff --git a/tests/system/Validation/CreditCardRulesTest.php b/tests/system/Validation/CreditCardRulesTest.php index 13168eed2f5b..6ef13c5ecee5 100644 --- a/tests/system/Validation/CreditCardRulesTest.php +++ b/tests/system/Validation/CreditCardRulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Services; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -64,7 +63,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm */ - public function creditCardProvider(): Generator + public function creditCardProvider(): iterable { yield from [ 'null_test' => [ diff --git a/tests/system/Validation/FormatRulesTest.php b/tests/system/Validation/FormatRulesTest.php index 8e78750e494e..7f1de6439345 100644 --- a/tests/system/Validation/FormatRulesTest.php +++ b/tests/system/Validation/FormatRulesTest.php @@ -129,7 +129,7 @@ public function testValidURLStrictWithSchema() $this->assertFalse($this->validation->run($data)); } - public function urlProvider(): Generator + public function urlProvider(): iterable { yield from [ [ @@ -260,7 +260,7 @@ public function testValidEmails(?string $email, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function emailProviderSingle(): Generator + public function emailProviderSingle(): iterable { yield from [ [ @@ -278,7 +278,7 @@ public function emailProviderSingle(): Generator ]; } - public function emailsProvider(): Generator + public function emailsProvider(): iterable { yield from [ [ @@ -324,7 +324,7 @@ public function testValidIP(?string $ip, ?string $which, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ipProvider(): Generator + public function ipProvider(): iterable { yield from [ [ @@ -393,7 +393,7 @@ public function testString($str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function stringProvider(): Generator + public function stringProvider(): iterable { yield from [ [ @@ -427,7 +427,7 @@ public function testAlpha(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaProvider(): Generator + public function alphaProvider(): iterable { yield from [ [ @@ -469,7 +469,7 @@ public function testAlphaSpace(?string $value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaSpaceProvider(): Generator + public function alphaSpaceProvider(): iterable { yield from [ [ @@ -515,7 +515,7 @@ public function testAlphaNumeric(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaNumericProvider(): Generator + public function alphaNumericProvider(): iterable { yield from [ [ @@ -553,7 +553,7 @@ public function testAlphaNumericPunct(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaNumericPunctProvider(): Generator + public function alphaNumericPunctProvider(): iterable { yield from [ [ @@ -685,7 +685,7 @@ public function testAlphaDash(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function alphaDashProvider(): Generator + public function alphaDashProvider(): iterable { yield from [ [ @@ -723,7 +723,7 @@ public function testHex(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function hexProvider(): Generator + public function hexProvider(): iterable { yield from [ [ @@ -761,7 +761,7 @@ public function testNumeric(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function numericProvider(): Generator + public function numericProvider(): iterable { yield from [ [ @@ -837,7 +837,7 @@ public function testNumericWithInvalidTypeData($value, bool $expected): void $this->assertsame($expected, $this->validation->run($data)); } - public function integerInvalidTypeDataProvider(): Generator + public function integerInvalidTypeDataProvider(): iterable { // TypeError : CodeIgniter\Validation\FormatRules::integer(): Argument #1 ($str) must be of type ?string, array given // yield 'array with int' => [ @@ -883,7 +883,7 @@ public function testInteger(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function integerProvider(): Generator + public function integerProvider(): iterable { yield from [ [ @@ -937,7 +937,7 @@ public function testDecimal(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function decimalProvider(): Generator + public function decimalProvider(): iterable { yield from [ [ @@ -995,7 +995,7 @@ public function testNatural(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalProvider(): Generator + public function naturalProvider(): iterable { yield from [ [ @@ -1037,7 +1037,7 @@ public function testNaturalNoZero(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function naturalZeroProvider(): Generator + public function naturalZeroProvider(): iterable { yield from [ [ @@ -1079,7 +1079,7 @@ public function testBase64(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function base64Provider(): Generator + public function base64Provider(): iterable { yield from [ [ @@ -1113,7 +1113,7 @@ public function testJson(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function jsonProvider(): Generator + public function jsonProvider(): iterable { yield from [ [ @@ -1171,7 +1171,7 @@ public function testTimeZone(?string $str, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function timezoneProvider(): Generator + public function timezoneProvider(): iterable { yield from [ [ @@ -1209,7 +1209,7 @@ public function testValidDate(?string $str, ?string $format, bool $expected): vo $this->assertSame($expected, $this->validation->run($data)); } - public function validDateProvider(): Generator + public function validDateProvider(): iterable { yield from [ [ diff --git a/tests/system/Validation/RulesTest.php b/tests/system/Validation/RulesTest.php index 7760401655d6..fe10358e20ce 100644 --- a/tests/system/Validation/RulesTest.php +++ b/tests/system/Validation/RulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Test\CIUnitTestCase; use Config\Services; -use Generator; use stdClass; use Tests\Support\Validation\TestRules; @@ -61,7 +60,7 @@ public function testRequired(array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideRequiredCases(): Generator + public function provideRequiredCases(): iterable { yield from [ [['foo' => null], false], @@ -82,7 +81,7 @@ public function testIfExist(array $rules, array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function ifExistProvider(): Generator + public function ifExistProvider(): iterable { yield from [ [ @@ -135,7 +134,7 @@ public function testPermitEmpty(array $rules, array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function providePermitEmptyCases(): Generator + public function providePermitEmptyCases(): iterable { yield from [ // If the rule is only `permit_empty`, any value will pass. @@ -299,7 +298,7 @@ public function testMatches(array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideMatchesCases(): Generator + public function provideMatchesCases(): iterable { yield from [ [['foo' => null, 'bar' => null], true], @@ -317,7 +316,7 @@ public function testMatchesNested(array $data, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideMatchesNestedCases(): Generator + public function provideMatchesNestedCases(): iterable { yield from [ [['nested' => ['foo' => 'match', 'bar' => 'match']], true], @@ -352,7 +351,7 @@ public function testEquals(array $data, string $param, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideEqualsCases(): Generator + public function provideEqualsCases(): iterable { yield from [ 'null' => [['foo' => null], '', false], @@ -372,7 +371,7 @@ public function testMinLength(?string $data, string $length, bool $expected): vo $this->assertSame($expected, $this->validation->run(['foo' => $data])); } - public function provideMinLengthCases(): Generator + public function provideMinLengthCases(): iterable { yield from [ 'null' => [null, '2', false], @@ -406,7 +405,7 @@ public function testExactLength(?string $data, bool $expected): void $this->assertSame($expected, $this->validation->run(['foo' => $data])); } - public function provideExactLengthCases(): Generator + public function provideExactLengthCases(): iterable { yield from [ 'null' => [null, false], @@ -433,7 +432,7 @@ public function testGreaterThan(?string $first, ?string $second, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanProvider(): Generator + public function greaterThanProvider(): iterable { yield from [ ['-10', '-11', true], @@ -458,7 +457,7 @@ public function testGreaterThanEqual(?string $first, ?string $second, bool $expe $this->assertSame($expected, $this->validation->run($data)); } - public function greaterThanEqualProvider(): Generator + public function greaterThanEqualProvider(): iterable { yield from [ ['0', '0', true], @@ -484,7 +483,7 @@ public function testLessThan(?string $first, ?string $second, bool $expected): v $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanProvider(): Generator + public function lessThanProvider(): iterable { yield from [ ['-10', '-11', false], @@ -510,7 +509,7 @@ public function testLessThanEqual(?string $first, ?string $second, bool $expecte $this->assertSame($expected, $this->validation->run($data)); } - public function lessThanEqualProvider(): Generator + public function lessThanEqualProvider(): iterable { yield from [ ['0', '0', true], @@ -546,7 +545,7 @@ public function testNotInList(?string $first, ?string $second, bool $expected): $this->assertSame(! $expected, $this->validation->run($data)); } - public function inListProvider(): Generator + public function inListProvider(): iterable { yield from [ ['red', 'red,Blue,123', true], @@ -582,7 +581,7 @@ public function testRequiredWith(?string $field, ?string $check, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithProvider(): Generator + public function requiredWithProvider(): iterable { yield from [ ['nope', 'bar', false], @@ -630,7 +629,7 @@ public function testRequiredWithAndOtherRules(bool $expected, array $data): void $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRulesProvider(): Generator + public function RequiredWithAndOtherRulesProvider(): iterable { yield from [ // `otherField` and `mustBeADate` do not exist @@ -667,7 +666,7 @@ public function testRequiredWithAndOtherRuleWithValueZero(bool $expected, array $this->assertSame($expected, $result); } - public function RequiredWithAndOtherRuleWithValueZeroProvider(): Generator + public function RequiredWithAndOtherRuleWithValueZeroProvider(): iterable { yield from [ [true, ['married' => '0', 'partner_name' => '']], @@ -697,7 +696,7 @@ public function testRequiredWithout(?string $field, ?string $check, bool $expect $this->assertSame($expected, $this->validation->run($data)); } - public function requiredWithoutProvider(): Generator + public function requiredWithoutProvider(): iterable { yield from [ ['nope', 'bars', false], @@ -743,7 +742,7 @@ public function testRequiredWithoutMultiple(string $foo, string $bar, string $ba $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleProvider(): Generator + public function requiredWithoutMultipleProvider(): iterable { yield from [ 'all empty' => [ @@ -789,7 +788,7 @@ public function testRequiredWithoutMultipleWithoutFields(array $data, bool $resu $this->assertSame($result, $this->validation->run($data)); } - public function requiredWithoutMultipleWithoutFieldsProvider(): Generator + public function requiredWithoutMultipleWithoutFieldsProvider(): iterable { yield from [ 'baz is missing' => [ diff --git a/tests/system/Validation/StrictRules/CreditCardRulesTest.php b/tests/system/Validation/StrictRules/CreditCardRulesTest.php index a0619df06cc0..f6441c70b7fd 100644 --- a/tests/system/Validation/StrictRules/CreditCardRulesTest.php +++ b/tests/system/Validation/StrictRules/CreditCardRulesTest.php @@ -14,7 +14,6 @@ use CodeIgniter\Test\CIUnitTestCase; use CodeIgniter\Validation\Validation; use Config\Services; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -65,7 +64,7 @@ public function testValidCCNumber(string $type, ?string $number, bool $expected) * * @see https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card_numbers.htm */ - public function creditCardProvider(): Generator + public function creditCardProvider(): iterable { yield from [ 'null_test' => [ diff --git a/tests/system/Validation/StrictRules/RulesTest.php b/tests/system/Validation/StrictRules/RulesTest.php index 4389a48b0ff1..2bbddad70561 100644 --- a/tests/system/Validation/StrictRules/RulesTest.php +++ b/tests/system/Validation/StrictRules/RulesTest.php @@ -13,7 +13,6 @@ use CodeIgniter\Validation\RulesTest as TraditionalRulesTest; use CodeIgniter\Validation\Validation; -use Generator; use Tests\Support\Validation\TestRules; /** @@ -51,7 +50,7 @@ public function testPermitEmptyStrict(array $rules, array $data, bool $expected) $this->assertSame($expected, $this->validation->run($data)); } - public function providePermitEmptyCasesStrict(): Generator + public function providePermitEmptyCasesStrict(): iterable { yield from [ [ @@ -106,7 +105,7 @@ public function testGreaterThanEqualStrict($value, string $param, bool $expected $this->assertSame($expected, $this->validation->run($data)); } - public function provideGreaterThanEqualStrict(): Generator + public function provideGreaterThanEqualStrict(): iterable { yield from [ [0, '0', true], @@ -132,7 +131,7 @@ public function testGreaterThanStrict($value, string $param, bool $expected): vo $this->assertSame($expected, $this->validation->run($data)); } - public function provideGreaterThanStrict(): Generator + public function provideGreaterThanStrict(): iterable { yield from [ [-10, '-11', true], @@ -159,7 +158,7 @@ public function testLessThanStrict($value, string $param, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function provideLessThanStrict(): Generator + public function provideLessThanStrict(): iterable { yield from [ [-10, '-11', false], @@ -187,7 +186,7 @@ public function testLessEqualThanStrict($value, ?string $param, bool $expected): $this->assertSame($expected, $this->validation->run($data)); } - public function provideLessThanEqualStrict(): Generator + public function provideLessThanEqualStrict(): iterable { yield from [ [0, '0', true], diff --git a/tests/system/Validation/ValidationTest.php b/tests/system/Validation/ValidationTest.php index efc00290ebd4..638dd56e26d2 100644 --- a/tests/system/Validation/ValidationTest.php +++ b/tests/system/Validation/ValidationTest.php @@ -18,7 +18,6 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use Config\App; use Config\Services; -use Generator; use PHPUnit\Framework\ExpectationFailedException; use Tests\Support\Validation\TestRules; use TypeError; @@ -339,7 +338,7 @@ public function testCanValidatetArrayData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function arrayDataProvider(): Generator + public function arrayDataProvider(): iterable { yield 'list array' => [ [1, 2, 3, 4, 5], @@ -391,7 +390,7 @@ public function testIsIntWithInvalidTypeData($value, bool $expected): void $this->assertSame($expected, $this->validation->run($data)); } - public function isIntInvalidTypeDataProvider(): Generator + public function isIntInvalidTypeDataProvider(): iterable { yield 'array with int' => [ [555], @@ -623,7 +622,7 @@ public function testRulesSetup($rules, $expected, array $errors = []) $this->assertSame($expected, $this->validation->getError('foo')); } - public function rulesSetupProvider(): Generator + public function rulesSetupProvider(): iterable { yield from [ [ @@ -971,7 +970,7 @@ public function testRulesForArrayField(array $body, array $rules, array $results $this->assertSame($results, $this->validation->getErrors()); } - public function arrayFieldDataProvider(): Generator + public function arrayFieldDataProvider(): iterable { yield from [ 'all_rules_should_pass' => [ @@ -1206,7 +1205,7 @@ public function testDotNotationOnIfExistRule(bool $expected, array $rules, array $this->assertSame($expected, $actual); } - public function dotNotationForIfExistProvider(): Generator + public function dotNotationForIfExistProvider(): iterable { yield 'dot-on-end-fail' => [ false, diff --git a/tests/system/View/ParserTest.php b/tests/system/View/ParserTest.php index cfa2ab1e81e8..d1bd13620470 100644 --- a/tests/system/View/ParserTest.php +++ b/tests/system/View/ParserTest.php @@ -418,7 +418,7 @@ public function testMismatchedVarPair() $this->assertSame($result, $this->parser->renderString($template)); } - public function escValueTypes() + public function escValueTypes(): iterable { return [ 'scalar' => [42], From 150583c47cda3048e751b1bfd79c788f6962a7fa Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 17 Jul 2023 16:46:27 +0800 Subject: [PATCH 216/237] Bump to phpstan level 6 --- phpstan.neon.dist | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index b196b90397f5..4381202385b9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -14,14 +14,13 @@ includes: parameters: phpVersion: 80100 tmpDir: build/phpstan - level: 5 + level: 6 + bootstrapFiles: + - phpstan-bootstrap.php paths: - app - system - utils/PHPStan - treatPhpDocTypesAsCertain: false - bootstrapFiles: - - phpstan-bootstrap.php excludePaths: - app/Views/errors/cli/* - app/Views/errors/html/* @@ -38,3 +37,7 @@ parameters: - APP_NAMESPACE - CI_DEBUG - ENVIRONMENT + checkMissingIterableValueType: false + checkGenericClassInNonGenericObjectType: false + checkMissingCallableSignature: true + treatPhpDocTypesAsCertain: false From 6c70392b05c20d535479d82a7c67efdaa172a9b2 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 17 Jul 2023 16:58:59 +0800 Subject: [PATCH 217/237] Dump existing 613 errors to PHP baseline --- composer.json | 2 +- phpstan-baseline.neon.dist | 271 ---- phpstan-baseline.php | 2920 ++++++++++++++++++++++++++++++++++++ phpstan.neon.dist | 2 +- 4 files changed, 2922 insertions(+), 273 deletions(-) delete mode 100644 phpstan-baseline.neon.dist create mode 100644 phpstan-baseline.php diff --git a/composer.json b/composer.json index 996b6d9ed5b5..b565963937fc 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "nexusphp/cs-config": "^3.6", "nexusphp/tachycardia": "^1.0", "php-coveralls/php-coveralls": "^2.5", - "phpstan/phpstan": "^1.7.1", + "phpstan/phpstan": "^1.10.2", "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", diff --git a/phpstan-baseline.neon.dist b/phpstan-baseline.neon.dist deleted file mode 100644 index 639b6dc79f5a..000000000000 --- a/phpstan-baseline.neon.dist +++ /dev/null @@ -1,271 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), 'loadClass'\\} given\\.$#" - count: 1 - path: system/Autoloader/Autoloader.php - - - - message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), 'loadClassmap'\\} given\\.$#" - count: 1 - path: system/Autoloader/Autoloader.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\HTTP\\\\Request\\:\\:getPost\\(\\)\\.$#" - count: 1 - path: system/CodeIgniter.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\HTTP\\\\Request\\:\\:setLocale\\(\\)\\.$#" - count: 1 - path: system/CodeIgniter.php - - - - message: "#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$db \\(CodeIgniter\\\\Database\\\\BaseConnection\\) in empty\\(\\) is not falsy\\.$#" - count: 1 - path: system/Database/BaseBuilder.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Database\\\\QueryInterface\\:\\:getOriginalQuery\\(\\)\\.$#" - count: 1 - path: system/Database/BaseConnection.php - - - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$DBDriver\\.$#" - count: 2 - path: system/Database/Database.php - - - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$connID\\.$#" - count: 2 - path: system/Database/Database.php - - - - message: "#^Property CodeIgniter\\\\Database\\\\Migration\\:\\:\\$DBGroup \\(string\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Database/Migration.php - - - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\\\:\\:\\$mysqli\\.$#" - count: 3 - path: system/Database/MySQLi/PreparedQuery.php - - - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#" - count: 2 - path: system/Database/SQLSRV/Builder.php - - - - message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#" - count: 13 - path: system/Database/SQLSRV/Forge.php - - - - message: "#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Debug/Toolbar/Collectors/Logs.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getData\\(\\)\\.$#" - count: 1 - path: system/Debug/Toolbar/Collectors/Views.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getPerformanceData\\(\\)\\.$#" - count: 2 - path: system/Debug/Toolbar/Collectors/Views.php - - - - message: "#^Static property CodeIgniter\\\\Email\\\\Email\\:\\:\\$func_overload \\(bool\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: system/Email/Email.php - - - - message: "#^Property CodeIgniter\\\\Files\\\\File\\:\\:\\$size \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Files/File.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Filters/Filters.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/HTTP/Files/UploadedFile.php - - - - message: "#^Property CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:\\$error \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 2 - path: system/HTTP/Files/UploadedFile.php - - - - message: "#^Return type \\(bool\\) of method CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:move\\(\\) should be compatible with return type \\(CodeIgniter\\\\Files\\\\File\\) of method CodeIgniter\\\\Files\\\\File\\:\\:move\\(\\)$#" - count: 1 - path: system/HTTP/Files/UploadedFile.php - - - - message: "#^Property CodeIgniter\\\\HTTP\\\\Message\\:\\:\\$protocolVersion \\(string\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/HTTP/Message.php - - - - message: "#^Variable \\$_GET on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: system/HTTP/RedirectResponse.php - - - - message: "#^Variable \\$_POST on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: system/HTTP/RedirectResponse.php - - - - message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$fragment \\(string\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/HTTP/URI.php - - - - message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$host \\(string\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/HTTP/URI.php - - - - message: "#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$path \\(string\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/HTTP/URI.php - - - - message: "#^Right side of && is always true\\.$#" - count: 1 - path: system/Helpers/filesystem_helper.php - - - - message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#" - count: 1 - path: system/Images/Handlers/BaseHandler.php - - - - message: "#^Comparison operation \"\\>\\=\" between \\(array\\|float\\|int\\) and 0 results in an error\\.$#" - count: 2 - path: system/Images/Handlers/ImageMagickHandler.php - - - - message: "#^PHPDoc type string\\|null of property CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:\\$resource is not covariant with PHPDoc type resource\\|null of overridden property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$resource\\.$#" - count: 1 - path: system/Images/Handlers/ImageMagickHandler.php - - - - message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$height \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 4 - path: system/Images/Handlers/ImageMagickHandler.php - - - - message: "#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$width \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 4 - path: system/Images/Handlers/ImageMagickHandler.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#" - count: 2 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFilterForRoute\\(\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFiltersForRoute\\(\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRoutesOptions\\(\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:isFiltered\\(\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:setHTTPVerb\\(\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRegisteredControllers\\(.*\\)\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Router/Router.php - - - - message: "#^Property CodeIgniter\\\\Session\\\\Session\\:\\:\\$sessionExpiration \\(int\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: system/Session/Session.php - - - - message: "#^Access to an undefined property object\\:\\:\\$createdField\\.$#" - count: 1 - path: system/Test/Fabricator.php - - - - message: "#^Access to an undefined property object\\:\\:\\$deletedField\\.$#" - count: 1 - path: system/Test/Fabricator.php - - - - message: "#^Access to an undefined property object\\:\\:\\$updatedField\\.$#" - count: 1 - path: system/Test/Fabricator.php - - - - message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$bodyFormat \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: system/Test/FeatureTestCase.php - - - - message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$clean \\(bool\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: system/Test/FeatureTestCase.php - - - - message: "#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$session \\(array\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Test/FeatureTestCase.php - - - - message: "#^Cannot access property \\$insert_id on object\\|resource\\|false\\.$#" - count: 1 - path: system/Test/Mock/MockConnection.php - - - - message: "#^Property CodeIgniter\\\\Throttle\\\\Throttler\\:\\:\\$testTime \\(int\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/Throttle/Throttler.php - - - - message: "#^Property CodeIgniter\\\\View\\\\Cell\\:\\:\\$cache \\(CodeIgniter\\\\Cache\\\\CacheInterface\\) in empty\\(\\) is not falsy\\.$#" - count: 2 - path: system/View/Cell.php - - - - message: "#^Call to an undefined static method CodeIgniter\\\\Config\\\\Factories\\:\\:cells\\(\\)\\.$#" - count: 1 - path: system/View/Cell.php - - - - message: "#^Property Config\\\\View\\:\\:\\$plugins \\(array\\) on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: system/View/Parser.php - - - - message: "#^Constructor of class CodeIgniter\\\\HTTP\\\\CURLRequest has an unused parameter \\$config\\.$#" - count: 1 - path: system/HTTP/CURLRequest.php diff --git a/phpstan-baseline.php b/phpstan-baseline.php new file mode 100644 index 000000000000..2aae3fc2eeb5 --- /dev/null +++ b/phpstan-baseline.php @@ -0,0 +1,2920 @@ + '#^Property Config\\\\Kint\\:\\:\\$plugins has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Config/Kint.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Config\\\\Kint\\:\\:\\$richObjectPlugins has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Config/Kint.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Config\\\\Kint\\:\\:\\$richTabPlugins has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Config/Kint.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method App\\\\Controllers\\\\BaseController\\:\\:initController\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Controllers/BaseController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method App\\\\Controllers\\\\Home\\:\\:index\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/app/Controllers/Home.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:discoverComposerNamespaces\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:register\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), \'loadClass\'\\} given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), \'loadClassmap\'\\} given\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:chunk\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/BaseModel.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:chunk\\(\\) has parameter \\$userFunc with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/BaseModel.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:doOnlyDeleted\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/BaseModel.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/BaseModel.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showError\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/BaseCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:showHelp\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/BaseCommand.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:beep\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:clearScreen\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:error\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:fwrite\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:generateDimensions\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:init\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:newLine\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:parseCommandLine\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:print\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:showProgress\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:table\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:wait\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\CLI\\:\\:write\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/CLI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\Commands\\:\\:discoverCommands\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/Commands.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CLI\\\\Console\\:\\:showHeader\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CLI/Console.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\CacheInterface\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/CacheInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandler\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\DummyHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/DummyHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\DummyHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/DummyHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\DummyHandler\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/DummyHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\FileHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/FileHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\FileHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/FileHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\MemcachedHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/MemcachedHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\MemcachedHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/MemcachedHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\PredisHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/PredisHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\PredisHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/PredisHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/RedisHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/RedisHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\WincacheHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/WincacheHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\WincacheHandler\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Cache/Handlers/WincacheHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\HTTP\\\\Request\\:\\:getPost\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\HTTP\\\\Request\\:\\:setLocale\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:bootstrapEnvironment\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:cache\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:detectEnvironment\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:forceSecureAccess\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:gatherOutput\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:getRequestObject\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:getResponseObject\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:initializeKint\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:resolvePlatformExtensions\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:spoofRequestMethod\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:startBenchmark\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:storePreviousURL\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\CodeIgniter\\:\\:\\$controller type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/CodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Database\\\\ShowTableInfo\\:\\:showAllTables\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Database/ShowTableInfo.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Database\\\\ShowTableInfo\\:\\:showDataOfTable\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Database/ShowTableInfo.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CellGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/CellGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\CommandGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/CommandGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ConfigGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ConfigGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ControllerGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ControllerGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\EntityGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/EntityGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\FilterGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/FilterGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\MigrationGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/MigrationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ModelGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ModelGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ScaffoldGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ScaffoldGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SeederGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/SeederGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SessionMigrationGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/SessionMigrationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\SessionMigrationGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/SessionMigrationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:generateClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Generators\\\\ValidationGenerator\\:\\:generateView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Generators/ValidationGenerator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\ListCommands\\:\\:listFull\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/ListCommands.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\ListCommands\\:\\:listSimple\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/ListCommands.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\AutoRouteCollector\\:\\:addFilters\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Commands\\\\Utilities\\\\Routes\\\\AutoRouterImproved\\\\AutoRouteCollector\\:\\:addFilters\\(\\) has parameter \\$routes with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function force_https\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Common.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function helper\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Common.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function timer\\(\\) has parameter \\$callable with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Common.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\ComposerScripts\\:\\:postUpdate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/ComposerScripts.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseConfig\\:\\:registerProperties\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/BaseConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:injectMock\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/BaseService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:reset\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/BaseService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\BaseService\\:\\:resetSingle\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/BaseService.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\Config\\:\\:injectMock\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/Config.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\Config\\:\\:reset\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/Config.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\DotEnv\\:\\:setVariable\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/DotEnv.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\Factories\\:\\:injectMock\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/Factories.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\Factories\\:\\:reset\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/Factories.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Config\\\\ForeignCharacters\\:\\:\\$characterList has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/ForeignCharacters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Config\\\\Publisher\\:\\:registerProperties\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/Publisher.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$filters has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Config\\\\View\\:\\:\\$plugins has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Config/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Controller\\:\\:cachePage\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Controller.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Controller\\:\\:forceHTTPS\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Controller.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Controller\\:\\:initController\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Controller.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Controller\\:\\:loadHelpers\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Controller.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:_whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:addUnionStatement\\(\\) has parameter \\$union with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:buildSubquery\\(\\) has parameter \\$builder with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:havingIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:havingNotIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:orHavingIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:orHavingNotIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:orWhereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:orWhereNotIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:resetRun\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:resetSelect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:resetWrite\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:union\\(\\) has parameter \\$union with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:unionAll\\(\\) has parameter \\$union with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:whereIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:whereNotIn\\(\\) has parameter \\$values with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$db \\(CodeIgniter\\\\Database\\\\BaseConnection\\) in empty\\(\\) is not falsy\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseBuilder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Database\\\\QueryInterface\\:\\:getOriginalQuery\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseConnection\\:\\:close\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseConnection\\:\\:prepare\\(\\) has parameter \\$func with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseConnection\\:\\:transOff\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BaseConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\BasePreparedQuery\\:\\:execute\\(\\) has parameter \\$data with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/BasePreparedQuery.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Config\\:\\:ensureFactory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Config.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$DBDriver\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Database/Database.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\ConnectionInterface\\:\\:\\$connID\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Database/Database.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Exceptions\\\\DataException\\:\\:forEmptyInputGiven\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Exceptions/DataException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Exceptions\\\\DataException\\:\\:forFindColumnHaveMultipleColumns\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Exceptions/DataException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Exceptions\\\\DataException\\:\\:forInvalidAllowedFields\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Exceptions/DataException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Exceptions\\\\DataException\\:\\:forTableNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Exceptions/DataException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:_attributeAutoIncrement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:_attributeDefault\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:_attributeType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:_attributeUnique\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:_attributeUnsigned\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Forge\\:\\:reset\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Migration\\:\\:down\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Migration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Migration\\:\\:up\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Migration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Migration\\:\\:\\$DBGroup \\(string\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Migration.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\MigrationRunner\\:\\:addHistory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/MigrationRunner.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\MigrationRunner\\:\\:clearHistory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/MigrationRunner.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\MigrationRunner\\:\\:ensureTable\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/MigrationRunner.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\MigrationRunner\\:\\:force\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/MigrationRunner.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\MigrationRunner\\:\\:removeHistory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/MigrationRunner.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\ModelFactory\\:\\:injectMock\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/ModelFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\ModelFactory\\:\\:reset\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/ModelFactory.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\\\:\\:\\$mysqli\\.$#', + 'count' => 3, + 'path' => __DIR__ . '/system/Database/MySQLi/PreparedQuery.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\OCI8\\\\Builder\\:\\:resetSelect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/OCI8/Builder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:\\$resetStmtId has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/OCI8/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\OCI8\\\\Connection\\:\\:\\$validDSNs has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/OCI8/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:buildDSN\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:convertDSN\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$connect_timeout has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$options has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$service has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Database\\\\Postgre\\\\Connection\\:\\:\\$sslmode has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Connection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Forge\\:\\:_attributeAutoIncrement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Postgre\\\\Forge\\:\\:_attributeType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Postgre/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\PreparedQueryInterface\\:\\:execute\\(\\) has parameter \\$data with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/PreparedQueryInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Query\\:\\:compileBinds\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Query.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\QueryInterface\\:\\:setError\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/QueryInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\ResultInterface\\:\\:freeResult\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/ResultInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Database/SQLSRV/Builder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#', + 'count' => 13, + 'path' => __DIR__ . '/system/Database/SQLSRV/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Forge\\:\\:_attributeAutoIncrement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLSRV/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLSRV\\\\Forge\\:\\:_attributeType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLSRV/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Forge\\:\\:_attributeAutoIncrement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLite3/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Forge\\:\\:_attributeType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLite3/Forge.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Table\\:\\:copyData\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLite3/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\SQLite3\\\\Table\\:\\:dropIndexes\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/SQLite3/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Database\\\\Seeder\\:\\:call\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Database/Seeder.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:exceptionHandler\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Exceptions.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Exceptions.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:maskSensitiveData\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Exceptions.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:render\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Exceptions.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:shutdownHandler\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Exceptions.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Iterator\\:\\:add\\(\\) has parameter \\$closure with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Iterator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Timer\\:\\:record\\(\\) has parameter \\$callable with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Timer.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:prepare\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\:\\:respond\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getBadgeValue\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getVarData\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/BaseCollector.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:collect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Database\\:\\:getConnections\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Database.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\History\\:\\:setFiles\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/History.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\Logs\\:\\:collectLogs\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Logs.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Logs.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getData\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Views.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\View\\\\RendererInterface\\:\\:getPerformanceData\\(\\)\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Views.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:SMTPEnd\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:appendAttachments\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:batchBCCSend\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:buildHeaders\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:buildMessage\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:setErrorMessage\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:unwrapSpecials\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Email\\\\Email\\:\\:writeHeaders\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Static property CodeIgniter\\\\Email\\\\Email\\:\\:\\$func_overload \\(bool\\) in isset\\(\\) is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Email/Email.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Encryption\\\\Handlers\\\\SodiumHandler\\:\\:parseParams\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Encryption/Handlers/SodiumHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$casts has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Entity/Entity.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$datamap has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Entity/Entity.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$dates has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Entity/Entity.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:on\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:on\\(\\) has parameter \\$callback with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:removeAllListeners\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:removeListener\\(\\) has parameter \\$listener with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:setFiles\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Events\\\\Events\\:\\:simulate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Events/Events.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\CastException\\:\\:forInvalidJsonFormatException\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/CastException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\ConfigException\\:\\:forDisabledMigrations\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/ConfigException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\DownloadException\\:\\:forCannotSetBinary\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/DownloadException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\DownloadException\\:\\:forCannotSetCache\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/DownloadException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\DownloadException\\:\\:forCannotSetFilePath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/DownloadException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\DownloadException\\:\\:forCannotSetStatusCode\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/DownloadException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\DownloadException\\:\\:forNotFoundDownloadSource\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/DownloadException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forCopyError\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forEnabledZlibOutputCompression\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forFabricatorCreateFailed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forInvalidFile\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forMissingExtension\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\FrameworkException\\:\\:forNoHandlers\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/FrameworkException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\ModelException\\:\\:forMethodNotAvailable\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/ModelException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\ModelException\\:\\:forNoDateFormat\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/ModelException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\ModelException\\:\\:forNoPrimaryKey\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/ModelException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\PageNotFoundException\\:\\:forControllerNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\PageNotFoundException\\:\\:forEmptyController\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\PageNotFoundException\\:\\:forLocaleNotSupported\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\PageNotFoundException\\:\\:forMethodNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\PageNotFoundException\\:\\:forPageNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/PageNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Exceptions\\\\TestException\\:\\:forInvalidMockClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Exceptions/TestException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forExpectedDirectory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Files/Exceptions/FileException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forExpectedFile\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Files/Exceptions/FileException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileException\\:\\:forUnableToMove\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Files/Exceptions/FileException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Files\\\\Exceptions\\\\FileNotFoundException\\:\\:forFileNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Files/Exceptions/FileNotFoundException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Files\\\\File\\:\\:\\$size \\(int\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Files/File.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:discoverFilters\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:processAliasesToClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:processFilters\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:processGlobals\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:processMethods\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Filters\\\\Filters\\:\\:setResponse\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Filters/Filters.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Format\\\\XMLFormatter\\:\\:arrayToXML\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Format/XMLFormatter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CLIRequest\\:\\:parseCommand\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/CLIRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Constructor of class CodeIgniter\\\\HTTP\\\\CURLRequest has an unused parameter \\$config\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:parseOptions\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:resetOptions\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:setResponseHeaders\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicy\\:\\:addOption\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/ContentSecurityPolicy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicy\\:\\:addToHeader\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/ContentSecurityPolicy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicy\\:\\:buildHeaders\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/ContentSecurityPolicy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicy\\:\\:finalize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/ContentSecurityPolicy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicy\\:\\:generateNonces\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/ContentSecurityPolicy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\DownloadResponse\\:\\:buildHeaders\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/DownloadResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\DownloadResponse\\:\\:setBinary\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/DownloadResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\DownloadResponse\\:\\:setContentTypeByMimeType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/DownloadResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\DownloadResponse\\:\\:setFilePath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/DownloadResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\Files\\\\FileCollection\\:\\:populateFiles\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Files/FileCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Files/UploadedFile.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:\\$error \\(int\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/HTTP/Files/UploadedFile.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Return type \\(bool\\) of method CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFile\\:\\:move\\(\\) should be compatible with return type \\(CodeIgniter\\\\Files\\\\File\\) of method CodeIgniter\\\\Files\\\\File\\:\\:move\\(\\)$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Files/UploadedFile.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\Files\\\\UploadedFileInterface\\:\\:move\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Files/UploadedFileInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\IncomingRequest\\:\\:detectLocale\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/IncomingRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\IncomingRequest\\:\\:detectURI\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/IncomingRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\HTTP\\\\Message\\:\\:\\$protocolVersion \\(string\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Message.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Variable \\$_GET on left side of \\?\\? always exists and is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/RedirectResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Variable \\$_POST on left side of \\?\\? always exists and is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/RedirectResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\Request\\:\\:populateGlobals\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Request.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\Response\\:\\:sendCookies\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/Response.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\URI\\:\\:applyParts\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/URI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$fragment \\(string\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/URI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$host \\(string\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/URI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\HTTP\\\\URI\\:\\:\\$path \\(string\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/URI.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\UserAgent\\:\\:compileData\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/UserAgent.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\HTTP\\\\UserAgent\\:\\:parse\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/HTTP/UserAgent.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function delete_cookie\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/cookie_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function set_cookie\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/cookie_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Right side of && is always true\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/filesystem_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function d\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/kint_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function d\\(\\) has parameter \\$vars with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/kint_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function dd\\(\\) has no return type specified\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Helpers/kint_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function dd\\(\\) has parameter \\$vars with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/kint_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function trace\\(\\) has no return type specified\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Helpers/kint_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Function mock\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Helpers/test_helper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoHiddenValue\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoNameField\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:forNoTemplate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Exceptions\\\\HoneypotException\\:\\:isBot\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Exceptions/HoneypotException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:attachHoneypot\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Honeypot.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Honeypot\\\\Honeypot\\:\\:hasContent\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Honeypot/Honeypot.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:setTestNow\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/I18n/Time.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\I18n\\\\Time\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/I18n/Time.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:setTestNow\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/I18n/TimeLegacy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\I18n\\\\TimeLegacy\\:\\:toDateTimeString\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/I18n/TimeLegacy.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forEXIFUnsupported\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forFileNotSupported\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forImageProcessFailed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidDirection\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageCreate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidImageLibraryPath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forInvalidPath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingAngle\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forMissingImage\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Exceptions\\\\ImageException\\:\\:forSaveFailed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Exceptions/ImageException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:_text\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:reproportion\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$image \\(CodeIgniter\\\\Images\\\\Image\\) in empty\\(\\) is not falsy\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Comparison operation "\\>\\=" between \\(array\\|float\\|int\\) and 0 results in an error\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:_text\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:ensureResource\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:supportedFormatCheck\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^PHPDoc type string\\|null of property CodeIgniter\\\\Images\\\\Handlers\\\\ImageMagickHandler\\:\\:\\$resource is not covariant with PHPDoc type resource\\|null of overridden property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$resource\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$height \\(int\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 4, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:\\$width \\(int\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 4, + 'path' => __DIR__ . '/system/Images/Handlers/ImageMagickHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Log\\\\Exceptions\\\\LogException\\:\\:forInvalidLogLevel\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Log/Exceptions/LogException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Log\\\\Exceptions\\\\LogException\\:\\:forInvalidMessageType\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Log/Exceptions/LogException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Log\\\\Handlers\\\\ChromeLoggerHandler\\:\\:sendLogs\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Log/Handlers/ChromeLoggerHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Model\\:\\:chunk\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Model.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Model\\:\\:chunk\\(\\) has parameter \\$userFunc with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Model.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Model\\:\\:doOnlyDeleted\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Model.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidPaginationGroup\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:calculateCurrentPage\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Pager/Pager.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:ensureGroup\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Pager/Pager.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Pager\\\\PagerRenderer\\:\\:updatePages\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Pager/PagerRenderer.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forCollision\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forDestinationNotAllowed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forFileNotAllowed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Publisher\\\\Publisher\\:\\:verifyAllowed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Publisher/Publisher.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:initController\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/RESTful/BaseResource.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:setModel\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/RESTful/BaseResource.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/AutoRouter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Router\\\\AutoRouter\\:\\:\\$cliRoutes type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/AutoRouter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:cli\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:delete\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:discoverRoutes\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:environment\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:get\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:get404Override\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:getControllerName\\(\\) has parameter \\$handler with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has parameter \\$params with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:head\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:match\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:options\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:patch\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:post\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:put\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:resetRoutes\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Router\\\\RouteCollection\\:\\:\\$override404 type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollectionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:get404Override\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollectionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouteCollectionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFilterForRoute\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getFiltersForRoute\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRegisteredControllers\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRoutesOptions\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:isFiltered\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:setHTTPVerb\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:autoRoute\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:get404Override\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:handle\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDefaultController\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDirectory\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setMatchedRoute\\(\\) has parameter \\$handler with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setRequest\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Router\\\\Router\\:\\:\\$controller type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/Router.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouterInterface\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouterInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Router\\\\RouterInterface\\:\\:handle\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Router/RouterInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forDisallowedAction\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidControlChars\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidSameSite\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Security\\\\Exceptions\\\\SecurityException\\:\\:forInvalidUTF8Chars\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Security/Exceptions/SecurityException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forEmptySavepath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forInvalidSameSiteSetting\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forInvalidSavePath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forInvalidSavePathFormat\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forMissingDatabaseTable\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forWriteProtectedSavePath\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Exceptions/SessionException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Session\\\\Handlers\\\\ArrayHandler\\:\\:\\$cache has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Handlers/ArrayHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Handlers\\\\Database\\\\PostgreHandler\\:\\:setSelect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Handlers/Database/PostgreHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Handlers\\\\DatabaseHandler\\:\\:setSelect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Handlers/DatabaseHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Handlers\\\\FileHandler\\:\\:configureSessionIDRegex\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Handlers/FileHandler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:configure\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:configureSidLength\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:destroy\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:initVars\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:keepFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:push\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:regenerate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:remove\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:removeTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:set\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:setCookie\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:setFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:setSaveHandler\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:setTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:startSession\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:stop\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:unmarkFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\Session\\:\\:unmarkTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Session\\\\Session\\:\\:\\$sessionExpiration \\(int\\) in isset\\(\\) is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/Session.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:destroy\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:keepFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:regenerate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:remove\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:removeTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:set\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:setFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:setTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:unmarkFlashdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Session\\\\SessionInterface\\:\\:unmarkTempdata\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Session/SessionInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:clearInsertCache\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:dontSeeInDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:loadDependencies\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:migrateDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:regressDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:resetMigrationSeedCount\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:runSeeds\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:seeInDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:seeNumRecords\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:seed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:setUpDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:setUpMigrate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:setUpSeed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIDatabaseTestCase\\:\\:tearDownDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIDatabaseTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:assertCloseEnough\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:getPrivateMethodInvoker\\(\\) return type has no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:mockCache\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:mockEmail\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:mockSession\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:resetFactories\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:resetServices\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:setPrivateProperty\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/CIUnitTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property object\\:\\:\\$createdField\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Fabricator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property object\\:\\:\\$deletedField\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Fabricator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Access to an undefined property object\\:\\:\\$updatedField\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Fabricator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Fabricator\\:\\:resetCounts\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Fabricator.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:clearInsertCache\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:dontSeeInDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:loadDependencies\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:migrateDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:regressDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:resetMigrationSeedCount\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:runSeeds\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:seeInDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:seeNumRecords\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:seed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:setUpDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:setUpMigrate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:setUpSeed\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\FeatureTestCase\\:\\:tearDownDatabase\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$bodyFormat \\(string\\) in isset\\(\\) is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$clean \\(bool\\) in isset\\(\\) is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\CIUnitTestCase\\:\\:\\$session \\(array\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/FeatureTestCase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCLIConfig\\:\\:\\$CSRFExcludeURIs has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCLIConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:getBaseURI\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:getDelay\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:setOutput\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:setOutput\\(\\) has parameter \\$output with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:\\$curl_options has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockCURLRequest\\:\\:\\$output has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCURLRequest.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHas\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertHasValue\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:assertMissing\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:initialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockCodeIgniter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$insert_id on object\\|resource\\|false\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:shouldReturn\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:shouldReturn\\(\\) has parameter \\$return with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:\\$returnValues has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockEvents\\:\\:getEventsFile\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockEvents.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockEvents\\:\\:getListeners\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockEvents.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockEvents\\:\\:getSimulate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockEvents.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockEvents\\:\\:unInitialize\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockEvents.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockFileLogger\\:\\:\\$destination has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockFileLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockLanguage\\:\\:disableIntlSupport\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockLanguage.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockLogger\\:\\:\\$dateFormat has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockLogger\\:\\:\\$handlers has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockLogger\\:\\:\\$threshold has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourceController\\:\\:getFormat\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourceController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourceController\\:\\:getModel\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourceController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourceController\\:\\:getModelName\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourceController.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourcePresenter\\:\\:getFormat\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourcePresenter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourcePresenter\\:\\:getModel\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourcePresenter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResourcePresenter\\:\\:getModelName\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResourcePresenter.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResponse\\:\\:getPretend\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockResponse\\:\\:misbehave\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockSecurityConfig\\:\\:\\$excludeURIs has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSecurityConfig.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockServices\\:\\:\\$classmap has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockServices.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockServices\\:\\:\\$psr4 has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockServices.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockSession\\:\\:regenerate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSession.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockSession\\:\\:setCookie\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSession.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockSession\\:\\:setSaveHandler\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSession.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockSession\\:\\:startSession\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSession.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockSession\\:\\:\\$didRegenerate has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockSession.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockTable\\:\\:__call\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockTable.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockTable\\:\\:__call\\(\\) has parameter \\$method with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockTable.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockTable\\:\\:__call\\(\\) has parameter \\$params with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/Mock/MockTable.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\PhpStreamWrapper\\:\\:register\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/PhpStreamWrapper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\PhpStreamWrapper\\:\\:restore\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/PhpStreamWrapper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\PhpStreamWrapper\\:\\:setContent\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/PhpStreamWrapper.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestLogger\\:\\:cleanup\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Test\\\\TestLogger\\:\\:\\$op_logs has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestLogger.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertCookie\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertCookieExpired\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertCookieMissing\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertDontSee\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertDontSeeElement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertHeader\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertHeaderMissing\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertJSONExact\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertJSONFragment\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertNotOK\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertNotRedirect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertOK\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertRedirect\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertRedirectTo\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSee\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSeeElement\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSeeInField\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSeeLink\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSessionHas\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertSessionMissing\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Test\\\\TestResponse\\:\\:assertStatus\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Test/TestResponse.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\Throttle\\\\Throttler\\:\\:\\$testTime \\(int\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Throttle/Throttler.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotArray\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forGroupNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forNoRuleSets\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Exceptions\\\\ValidationException\\:\\:forRuleNotFound\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Exceptions/ValidationException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:isClosure\\(\\) has parameter \\$rule with no signature specified for Closure\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Validation.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:loadRuleSets\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Validation.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\Validation\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/Validation.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\Validation\\\\ValidationInterface\\:\\:setRuleGroup\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/Validation/ValidationInterface.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Call to an undefined static method CodeIgniter\\\\Config\\\\Factories\\:\\:cells\\(\\)\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Cell\\:\\:getMethodParams\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\View\\\\Cell\\:\\:\\$cache \\(CodeIgniter\\\\Cache\\\\CacheInterface\\) in empty\\(\\) is not falsy\\.$#', + 'count' => 2, + 'path' => __DIR__ . '/system/View/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Cells\\\\Cell\\:\\:setView\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Cells/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method class@anonymous/system/Traits/PropertiesTrait\\.php\\:47\\:\\:getProperties\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Cells/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method class@anonymous/system/Traits/PropertiesTrait\\.php\\:47\\:\\:getProperties\\(\\) has parameter \\$obj with no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Cells/Cell.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forInvalidCellClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forInvalidCellMethod\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forInvalidCellParameter\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forInvalidDecorator\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forMissingCellParameters\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forNoCellClass\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Exceptions\\\\ViewException\\:\\:forTagSyntaxError\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Exceptions/ViewException.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Parser\\:\\:addPlugin\\(\\) has parameter \\$callback with no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Parser.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property Config\\\\View\\:\\:\\$plugins \\(array\\) on left side of \\?\\? is not nullable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Parser.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_compileTemplate\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_setFromArray\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\Table\\:\\:_setFromDBResult\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\View\\\\Table\\:\\:\\$function type has no signature specified for callable\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/Table.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:endSection\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:extend\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:logPerformance\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:renderSection\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Method CodeIgniter\\\\View\\\\View\\:\\:section\\(\\) has no return type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Property CodeIgniter\\\\View\\\\View\\:\\:\\$tempData has no type specified\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/system/View/View.php', +]; + +return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4381202385b9..671b0133aaea 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,7 +9,7 @@ services: - phpstan.rules.rule includes: - - phpstan-baseline.neon.dist + - phpstan-baseline.php parameters: phpVersion: 80100 From d83416663ac49f665818e1cfbd676f28df613cbe Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Wed, 19 Jul 2023 08:37:05 +0700 Subject: [PATCH 218/237] `disableProcessTimeout` in `analyze` Composer --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 996b6d9ed5b5..04ef2f064627 100644 --- a/composer.json +++ b/composer.json @@ -77,6 +77,7 @@ "bash -c \"if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi\"" ], "analyze": [ + "Composer\\Config::disableProcessTimeout", "bash -c \"XDEBUG_MODE=off phpstan analyse\"", "rector process --dry-run" ], From 9810c1fe9e1ccc7fb51533354827ac1afc24d7ea Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 20 Jul 2023 15:21:01 +0800 Subject: [PATCH 219/237] Fix PHPDoc of Config\Cache::$validHandlers --- app/Config/Cache.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 5ba93328110f..61cdd50de890 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -2,6 +2,7 @@ namespace Config; +use CodeIgniter\Cache\CacheInterface; use CodeIgniter\Cache\Handlers\DummyHandler; use CodeIgniter\Cache\Handlers\FileHandler; use CodeIgniter\Cache\Handlers\MemcachedHandler; @@ -158,6 +159,7 @@ class Cache extends BaseConfig * that are listed here are allowed to be used. * * @var array + * @phpstan-var array> */ public array $validHandlers = [ 'dummy' => DummyHandler::class, From 2a2a40d29ff6e947390cec24525cff830f62ccd5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 10:09:37 +0900 Subject: [PATCH 220/237] chore: update test-phpstan.yml --- .github/workflows/test-phpstan.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-phpstan.yml b/.github/workflows/test-phpstan.yml index cb793c356d94..8e2a57685cba 100644 --- a/.github/workflows/test-phpstan.yml +++ b/.github/workflows/test-phpstan.yml @@ -12,7 +12,8 @@ on: - 'system/**.php' - 'utils/**.php' - composer.json - - '**.neon.dist' + - phpstan.neon.dist + - phpstan-baseline.php - '.github/workflows/test-phpstan.yml' push: @@ -24,7 +25,8 @@ on: - 'system/**.php' - 'utils/**.php' - composer.json - - '**.neon.dist' + - phpstan.neon.dist + - phpstan-baseline.php - '.github/workflows/test-phpstan.yml' concurrency: From da93771448f53c511e712c2b7ce08a08d79816ac Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 14:15:53 +0900 Subject: [PATCH 221/237] test: add test for maskSensitiveData() --- tests/system/Debug/ExceptionsTest.php | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index b2c2946054bb..6e5a41457647 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -147,4 +147,53 @@ public function testRenderBacktrace(): void ); } } + + public function testMaskSensitiveData(): void + { + $maskSensitiveData = $this->getPrivateMethodInvoker($this->exception, 'maskSensitiveData'); + + $trace = [ + 0 => [ + 'file' => '/var/www/CodeIgniter4/app/Controllers/Home.php', + 'line' => 15, + 'function' => 'f', + 'class' => 'App\\Controllers\\Home', + 'type' => '->', + 'args' => [ + 0 => (object) [ + 'password' => 'secret1', + ], + 1 => (object) [ + 'default' => [ + 'password' => 'secret2', + ], + ], + 2 => [ + 'password' => 'secret3', + ], + 3 => [ + 'default' => ['password' => 'secret4'], + ], + ], + ], + 1 => [ + 'file' => '/var/www/CodeIgniter4/system/CodeIgniter.php', + 'line' => 932, + 'function' => 'index', + 'class' => 'App\\Controllers\\Home', + 'type' => '->', + 'args' => [ + ], + ], + ]; + $keysToMask = ['password']; + $path = ''; + + $newTrace = $maskSensitiveData($trace, $keysToMask, $path); + + $this->assertSame(['password' => '******************'], (array) $newTrace[0]['args'][0]); + $this->assertSame(['password' => '******************'], $newTrace[0]['args'][1]->default); + $this->assertSame(['password' => '******************'], $newTrace[0]['args'][2]); + $this->assertSame(['password' => '******************'], $newTrace[0]['args'][3]['default']); + } } From 6b624d67463b455f1a1673ed12234d31a1988010 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 14:16:27 +0900 Subject: [PATCH 222/237] fix: $sensitiveDataInTrace does not work --- system/Debug/Exceptions.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 531e95fd9808..11046552de48 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -293,7 +293,7 @@ protected function collectVars(Throwable $exception, int $statusCode): array $trace = $exception->getTrace(); if ($this->config->sensitiveDataInTrace !== []) { - $this->maskSensitiveData($trace, $this->config->sensitiveDataInTrace); + $trace = $this->maskSensitiveData($trace, $this->config->sensitiveDataInTrace); } return [ @@ -311,8 +311,10 @@ protected function collectVars(Throwable $exception, int $statusCode): array * Mask sensitive data in the trace. * * @param array|object $trace + * + * @return array|object */ - protected function maskSensitiveData(&$trace, array $keysToMask, string $path = '') + protected function maskSensitiveData($trace, array $keysToMask, string $path = '') { foreach ($keysToMask as $keyToMask) { $explode = explode('/', $keyToMask); @@ -327,15 +329,17 @@ protected function maskSensitiveData(&$trace, array $keysToMask, string $path = } } - if (is_object($trace)) { - $trace = get_object_vars($trace); - } - if (is_array($trace)) { foreach ($trace as $pathKey => $subarray) { - $this->maskSensitiveData($subarray, $keysToMask, $path . '/' . $pathKey); + $trace[$pathKey] = $this->maskSensitiveData($subarray, $keysToMask, $path . '/' . $pathKey); + } + } elseif (is_object($trace)) { + foreach ($trace as $pathKey => $subarray) { + $trace->{$pathKey} = $this->maskSensitiveData($subarray, $keysToMask, $path . '/' . $pathKey); } } + + return $trace; } /** From 36a5f5acc86d3d675f880e7a5f93049652a11382 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 14:37:21 +0900 Subject: [PATCH 223/237] test: add test for maskSensitiveData() and trace data key --- tests/system/Debug/ExceptionsTest.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index 6e5a41457647..4d0b1c3c98dd 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -196,4 +196,36 @@ public function testMaskSensitiveData(): void $this->assertSame(['password' => '******************'], $newTrace[0]['args'][2]); $this->assertSame(['password' => '******************'], $newTrace[0]['args'][3]['default']); } + + public function testMaskSensitiveDataTraceDataKey(): void + { + $maskSensitiveData = $this->getPrivateMethodInvoker($this->exception, 'maskSensitiveData'); + + $trace = [ + 0 => [ + 'file' => '/var/www/CodeIgniter4/app/Controllers/Home.php', + 'line' => 15, + 'function' => 'f', + 'class' => 'App\\Controllers\\Home', + 'type' => '->', + 'args' => [ + ], + ], + 1 => [ + 'file' => '/var/www/CodeIgniter4/system/CodeIgniter.php', + 'line' => 932, + 'function' => 'index', + 'class' => 'App\\Controllers\\Home', + 'type' => '->', + 'args' => [ + ], + ], + ]; + $keysToMask = ['file']; + $path = ''; + + $newTrace = $maskSensitiveData($trace, $keysToMask, $path); + + $this->assertSame('/var/www/CodeIgniter4/app/Controllers/Home.php', $newTrace[0]['file']); + } } From d6725aa534da6504af855ed7d957fad25f133bca Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 15:15:43 +0900 Subject: [PATCH 224/237] chore: fix cache file --- .php-cs-fixer.user-guide.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index c15d0dcca006..392d749c20f1 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -37,7 +37,7 @@ ]; $options = [ - 'cacheFile' => 'build/.php-cs-fixer.no-header.cache', + 'cacheFile' => 'build/.php-cs-fixer.user-guide.cache', 'finder' => $finder, ]; From 29af186d907852855d873090a0e4cbf6e03aad7e Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 15:06:55 +0900 Subject: [PATCH 225/237] fix: maskSensitiveData() may mask backtrace data like `file` --- phpstan-baseline.php | 5 ----- system/Debug/Exceptions.php | 39 ++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 2aae3fc2eeb5..26a2bbdf1afb 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -931,11 +931,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Debug/Exceptions.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:maskSensitiveData\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Debug/Exceptions.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Debug\\\\Exceptions\\:\\:render\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 11046552de48..6df81c16d5a5 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -315,31 +315,48 @@ protected function collectVars(Throwable $exception, int $statusCode): array * @return array|object */ protected function maskSensitiveData($trace, array $keysToMask, string $path = '') + { + foreach ($trace as $i => $line) { + $trace[$i]['args'] = $this->maskData($line['args'], $keysToMask); + } + + return $trace; + } + + /** + * @param array|object $args + * + * @return array|object + */ + private function maskData($args, array $keysToMask, string $path = '') { foreach ($keysToMask as $keyToMask) { $explode = explode('/', $keyToMask); $index = end($explode); if (strpos(strrev($path . '/' . $index), strrev($keyToMask)) === 0) { - if (is_array($trace) && array_key_exists($index, $trace)) { - $trace[$index] = '******************'; - } elseif (is_object($trace) && property_exists($trace, $index) && isset($trace->{$index})) { - $trace->{$index} = '******************'; + if (is_array($args) && array_key_exists($index, $args)) { + $args[$index] = '******************'; + } elseif ( + is_object($args) && property_exists($args, $index) + && isset($args->{$index}) && is_scalar($args->{$index}) + ) { + $args->{$index} = '******************'; } } } - if (is_array($trace)) { - foreach ($trace as $pathKey => $subarray) { - $trace[$pathKey] = $this->maskSensitiveData($subarray, $keysToMask, $path . '/' . $pathKey); + if (is_array($args)) { + foreach ($args as $pathKey => $subarray) { + $args[$pathKey] = $this->maskData($subarray, $keysToMask, $path . '/' . $pathKey); } - } elseif (is_object($trace)) { - foreach ($trace as $pathKey => $subarray) { - $trace->{$pathKey} = $this->maskSensitiveData($subarray, $keysToMask, $path . '/' . $pathKey); + } elseif (is_object($args)) { + foreach ($args as $pathKey => $subarray) { + $args->{$pathKey} = $this->maskData($subarray, $keysToMask, $path . '/' . $pathKey); } } - return $trace; + return $args; } /** From 13782b3a951884a79a6b55c073a5a943dd117499 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 21 Jul 2023 15:14:27 +0900 Subject: [PATCH 226/237] test: use `use` statement --- tests/system/Debug/ExceptionsTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/system/Debug/ExceptionsTest.php b/tests/system/Debug/ExceptionsTest.php index 4d0b1c3c98dd..a77745ba8a78 100644 --- a/tests/system/Debug/ExceptionsTest.php +++ b/tests/system/Debug/ExceptionsTest.php @@ -11,6 +11,7 @@ namespace CodeIgniter\Debug; +use App\Controllers\Home; use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Entity\Exceptions\CastException; use CodeIgniter\Exceptions\ConfigException; @@ -157,7 +158,7 @@ public function testMaskSensitiveData(): void 'file' => '/var/www/CodeIgniter4/app/Controllers/Home.php', 'line' => 15, 'function' => 'f', - 'class' => 'App\\Controllers\\Home', + 'class' => Home::class, 'type' => '->', 'args' => [ 0 => (object) [ @@ -180,7 +181,7 @@ public function testMaskSensitiveData(): void 'file' => '/var/www/CodeIgniter4/system/CodeIgniter.php', 'line' => 932, 'function' => 'index', - 'class' => 'App\\Controllers\\Home', + 'class' => Home::class, 'type' => '->', 'args' => [ ], @@ -206,7 +207,7 @@ public function testMaskSensitiveDataTraceDataKey(): void 'file' => '/var/www/CodeIgniter4/app/Controllers/Home.php', 'line' => 15, 'function' => 'f', - 'class' => 'App\\Controllers\\Home', + 'class' => Home::class, 'type' => '->', 'args' => [ ], @@ -215,7 +216,7 @@ public function testMaskSensitiveDataTraceDataKey(): void 'file' => '/var/www/CodeIgniter4/system/CodeIgniter.php', 'line' => 932, 'function' => 'index', - 'class' => 'App\\Controllers\\Home', + 'class' => Home::class, 'type' => '->', 'args' => [ ], From 96ed87356ce32a965d951a2615eeae6f951b53c5 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 21 Jul 2023 20:37:30 +0800 Subject: [PATCH 227/237] refactor: services function actually returns `object|null` --- system/Common.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/system/Common.php b/system/Common.php index bdc937af2aa7..9be45b3a9c08 100644 --- a/system/Common.php +++ b/system/Common.php @@ -1004,10 +1004,8 @@ function session(?string $val = null) * - $timer = \CodeIgniter\Config\Services::timer(); * * @param array|bool|float|int|object|string|null ...$params - * - * @return object */ - function service(string $name, ...$params) + function service(string $name, ...$params): ?object { return Services::$name(...$params); } @@ -1018,10 +1016,8 @@ function service(string $name, ...$params) * Always returns a new instance of the class. * * @param array|bool|float|int|object|string|null ...$params - * - * @return object|null */ - function single_service(string $name, ...$params) + function single_service(string $name, ...$params): ?object { $service = Services::serviceExists($name); From 23336a3289e2f3b68d0034734d6b268b93e7fa33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:08:36 +0000 Subject: [PATCH 228/237] build(deps-dev): update rector/rector requirement from 0.17.6 to 0.17.7 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.6...0.17.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 671a1023ca65..981db0694265 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "phpunit/phpcov": "^8.2", "phpunit/phpunit": "^9.1", "predis/predis": "^1.1 || ^2.0", - "rector/rector": "0.17.6", + "rector/rector": "0.17.7", "vimeo/psalm": "^5.0" }, "suggest": { From 246eba4c6f245d2c0f1813e806ebcee36d558b60 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 25 Jul 2023 13:56:29 +0900 Subject: [PATCH 229/237] fix: wrong Config classname to config() --- system/Debug/Toolbar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index 17e67aa8eb94..f00ad09bd122 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -365,7 +365,7 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r return; } - $toolbar = Services::toolbar(config(self::class)); + $toolbar = Services::toolbar(config(ToolbarConfig::class)); $stats = $app->getPerformanceStats(); $data = $toolbar->run( $stats['startTime'], From 75d87ed9d47cc9cacd4e232112dcd2fed6745a8a Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 19 Jul 2023 23:27:10 +0800 Subject: [PATCH 230/237] Fix failures due to line ending --- tests/system/Commands/RoutesTest.php | 2 +- tests/system/Commands/Utilities/NamespacesTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index 6d506274145d..bb89d35bb96d 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -39,7 +39,7 @@ protected function tearDown(): void protected function getBuffer() { - return $this->getStreamFilterBuffer(); + return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); } private function getCleanRoutes(): RouteCollection diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index 1b9d15a9e361..b561e4eea599 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -37,7 +37,7 @@ protected function tearDown(): void protected function getBuffer() { - return $this->getStreamFilterBuffer(); + return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); } public function testNamespacesCommandCodeIgniterOnly() From ccbfcfa7a7339d277606f7b2c2e0c6d19b67dfdb Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Tue, 25 Jul 2023 13:51:30 +0800 Subject: [PATCH 231/237] Fix failures due to path in heredoc --- tests/system/Commands/Utilities/NamespacesTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index b561e4eea599..26eabd32895f 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -35,9 +35,16 @@ protected function tearDown(): void $this->resetServices(); } + /** + * @see https://regex101.com/r/l3lHfR/1 + */ protected function getBuffer() { - return str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer()); + return preg_replace_callback('/(\|\s*[^|]+\s*\|\s*)(.*?)(\s*\|\s*[^|]+\s*\|)/', static function (array $matches) { + $matches[2] = str_replace(DIRECTORY_SEPARATOR, '/', $matches[2]); + + return $matches[1] . $matches[2] . $matches[3]; + }, str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer())); } public function testNamespacesCommandCodeIgniterOnly() From 9f8bc2feddd7956b78ec852eb3e21806bd9394c2 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 21 Jul 2023 17:58:53 +0800 Subject: [PATCH 232/237] style: Use all available checked tokens for `no_extra_blank_lines` --- .php-cs-fixer.dist.php | 17 +++++++++++++++ .php-cs-fixer.no-header.php | 17 +++++++++++++++ .php-cs-fixer.user-guide.php | 21 ++++++++++++++++++- app/Config/Logger.php | 2 -- .../Live/OCI8/CallStoredProcedureTest.php | 3 --- tests/system/Database/Live/UpdateTest.php | 1 - tests/system/Database/Live/UpsertTest.php | 3 --- tests/system/Test/TestCaseTest.php | 1 - 8 files changed, 54 insertions(+), 11 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 928f5b801071..3f9a0dd6f254 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -45,6 +45,23 @@ $overrides = [ 'php_unit_data_provider_return_type' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'attribute', + 'break', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'return', + 'square_brace_block', + 'switch', + 'throw', + 'use', + ], + ], ]; $options = [ diff --git a/.php-cs-fixer.no-header.php b/.php-cs-fixer.no-header.php index 954a06ec0230..16271f3cb31c 100644 --- a/.php-cs-fixer.no-header.php +++ b/.php-cs-fixer.no-header.php @@ -31,6 +31,23 @@ $overrides = [ 'php_unit_data_provider_return_type' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'attribute', + 'break', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'return', + 'square_brace_block', + 'switch', + 'throw', + 'use', + ], + ], ]; $options = [ diff --git a/.php-cs-fixer.user-guide.php b/.php-cs-fixer.user-guide.php index 392d749c20f1..ef37d80386bd 100644 --- a/.php-cs-fixer.user-guide.php +++ b/.php-cs-fixer.user-guide.php @@ -24,8 +24,10 @@ ]) ->notPath([ 'ci3sample/', - 'libraries/sessions/016.php', 'database/query_builder/075.php', + 'libraries/sessions/016.php', + 'outgoing/response/031.php', + 'outgoing/response/032.php', ]); $overrides = [ @@ -34,6 +36,23 @@ 'no_unused_imports' => false, 'class_attributes_separation' => false, 'php_unit_data_provider_return_type' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'attribute', + 'break', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'return', + 'square_brace_block', + 'switch', + 'throw', + 'use', + ], + ], ]; $options = [ diff --git a/app/Config/Logger.php b/app/Config/Logger.php index 3fb341c6c04f..568c5da658ba 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -74,14 +74,12 @@ class Logger extends BaseConfig * the handler on top and continuing down. */ public array $handlers = [ - /* * -------------------------------------------------------------------- * File Handler * -------------------------------------------------------------------- */ FileHandler::class => [ - // The log levels that this handler will handle. 'handles' => [ 'critical', diff --git a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php index 3b85fd068d36..4b174a0f72a2 100644 --- a/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php +++ b/tests/system/Database/Live/OCI8/CallStoredProcedureTest.php @@ -51,7 +51,6 @@ public function testCallPackageProcedure() 'name' => ':output', 'value' => &$result, ], - ]); $this->assertSame($result, '7'); @@ -74,7 +73,6 @@ public function testCallStoredProcedure() 'name' => ':output', 'value' => &$result, ], - ]); $this->assertSame($result, '7'); @@ -90,7 +88,6 @@ public function testCallStoredProcedureForCursor() 'type' => OCI_B_CURSOR, 'value' => &$result, ], - ]); oci_execute($result); diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index 031bbbc12be9..db998100395d 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -342,7 +342,6 @@ public function testUpdateBatchUpdateFieldsAndAlias() 'country' => 'Greece', ], [ - 'email' => 'ahmadinejad@world.com', 'name' => 'Ahmadinejad No change', 'country' => 'Greece', diff --git a/tests/system/Database/Live/UpsertTest.php b/tests/system/Database/Live/UpsertTest.php index f8ad456b1bc2..51289b879da5 100644 --- a/tests/system/Database/Live/UpsertTest.php +++ b/tests/system/Database/Live/UpsertTest.php @@ -98,11 +98,8 @@ public function testUpsertAndUpsertBatchWithObject() break; case 'Postgre': - case 'SQLite3': - case 'SQLSRV': - case 'OCI8': // postgre, sqlite, sqlsrv, oracle - counts row with no change $this->assertSame(3, $affectedRows1); diff --git a/tests/system/Test/TestCaseTest.php b/tests/system/Test/TestCaseTest.php index d94403a10b6a..dc2feda00210 100644 --- a/tests/system/Test/TestCaseTest.php +++ b/tests/system/Test/TestCaseTest.php @@ -14,7 +14,6 @@ use CodeIgniter\CLI\CLI; use CodeIgniter\Events\Events; use CodeIgniter\HTTP\Response; - use Config\App; /** From 1890d05b99dcae369a722e109f6ef6c1d40e7099 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 27 Jul 2023 11:30:45 +0800 Subject: [PATCH 233/237] docs: replace `U+2019` with `U+0060` --- app/Config/Filters.php | 2 +- changelogs/CHANGELOG_4.0.md | 4 ++-- contributing/pull_request.md | 2 +- system/Database/OCI8/Forge.php | 2 +- system/HTTP/ContentSecurityPolicy.php | 2 +- user_guide_src/source/libraries/sessions.rst | 2 +- user_guide_src/source/outgoing/response.rst | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 7b70c4fb3381..f751b8c2b581 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -49,7 +49,7 @@ class Filters extends BaseConfig * * If you use this, you should disable auto-routing because auto-routing * permits any HTTP method to access a controller. Accessing the controller - * with a method you don’t expect could bypass the filter. + * with a method you don't expect could bypass the filter. */ public array $methods = []; diff --git a/changelogs/CHANGELOG_4.0.md b/changelogs/CHANGELOG_4.0.md index ba2a9a85826d..57492ecaed6a 100644 --- a/changelogs/CHANGELOG_4.0.md +++ b/changelogs/CHANGELOG_4.0.md @@ -515,7 +515,7 @@ These changes increase security when handling uploaded files as the client can n - Add hex2bin prefix handling for encryption key [\#3307](https://github.com/codeigniter4/CodeIgniter4/pull/3307) ([michalsn](https://github.com/michalsn)) - add break; in foreach at Time::getDst\(\) when daylightSaving set [\#3305](https://github.com/codeigniter4/CodeIgniter4/pull/3305) ([samsonasik](https://github.com/samsonasik)) - New command: cache:clear [\#3304](https://github.com/codeigniter4/CodeIgniter4/pull/3304) ([lonnieezell](https://github.com/lonnieezell)) -- force\_https didn’t force https [\#3302](https://github.com/codeigniter4/CodeIgniter4/pull/3302) ([colethorsen](https://github.com/colethorsen)) +- force\_https didn't force https [\#3302](https://github.com/codeigniter4/CodeIgniter4/pull/3302) ([colethorsen](https://github.com/colethorsen)) - add test for CommandRunner::\_remap\(\) with empty first params [\#3301](https://github.com/codeigniter4/CodeIgniter4/pull/3301) ([samsonasik](https://github.com/samsonasik)) - FieldData -\> add typeName field and length field [\#3299](https://github.com/codeigniter4/CodeIgniter4/pull/3299) ([devorama](https://github.com/devorama)) - reduce repetitive getDefaultNamespace\(\) and controllerName\(\) function call in Router [\#3298](https://github.com/codeigniter4/CodeIgniter4/pull/3298) ([samsonasik](https://github.com/samsonasik)) @@ -2380,7 +2380,7 @@ These changes increase security when handling uploaded files as the client can n - Database can't save connect instances because var "$group" default is NULL [\#466](https://github.com/codeigniter4/CodeIgniter4/issues/466) - redirect\(\) issue [\#465](https://github.com/codeigniter4/CodeIgniter4/issues/465) - Join not working in Query Builder [\#464](https://github.com/codeigniter4/CodeIgniter4/issues/464) -- If the controller’s method's parameter has a default value , the program will show 500 error [\#461](https://github.com/codeigniter4/CodeIgniter4/issues/461) +- If the controller's method's parameter has a default value , the program will show 500 error [\#461](https://github.com/codeigniter4/CodeIgniter4/issues/461) - Wrong ROOTPATH on console [\#460](https://github.com/codeigniter4/CodeIgniter4/issues/460) - Rename "public" Folder Not Working [\#453](https://github.com/codeigniter4/CodeIgniter4/issues/453) - Environment File [\#452](https://github.com/codeigniter4/CodeIgniter4/issues/452) diff --git a/contributing/pull_request.md b/contributing/pull_request.md index a28e5e75d171..3acd1f1c6219 100644 --- a/contributing/pull_request.md +++ b/contributing/pull_request.md @@ -28,7 +28,7 @@ Before we look into how to contribute to CodeIgniter4, here are some guidelines. Your Pull Requests (PRs) need to meet our guidelines. If your Pull Requests fail to pass these guidelines, they will be declined, -and you will need to re-submit when you’ve made the changes. +and you will need to re-submit when you've made the changes. This might sound a bit tough, but it is required for us to maintain the quality of the codebase. ### PHP Style diff --git a/system/Database/OCI8/Forge.php b/system/Database/OCI8/Forge.php index 31b20584fe74..1eddd4a72888 100644 --- a/system/Database/OCI8/Forge.php +++ b/system/Database/OCI8/Forge.php @@ -187,7 +187,7 @@ protected function _attributeAutoIncrement(array &$attributes, array &$field) protected function _processColumn(array $field): string { $constraint = ''; - // @todo: can’t cover multi pattern when set type. + // @todo: can't cover multi pattern when set type. if ($field['type'] === 'VARCHAR2' && strpos($field['length'], "('") === 0) { $constraint = ' CHECK(' . $this->db->escapeIdentifiers($field['name']) . ' IN ' . $field['length'] . ')'; diff --git a/system/HTTP/ContentSecurityPolicy.php b/system/HTTP/ContentSecurityPolicy.php index 2ff9e355a83e..deb5093e86a8 100644 --- a/system/HTTP/ContentSecurityPolicy.php +++ b/system/HTTP/ContentSecurityPolicy.php @@ -327,7 +327,7 @@ public function reportOnly(bool $value = true) /** * Adds a new base_uri value. Can be either a URI class or a simple string. * - * base_uri restricts the URLs that can appear in a page’s element. + * base_uri restricts the URLs that can appear in a page's element. * * @see http://www.w3.org/TR/CSP/#directive-base-uri * diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 3c0e13d77552..4e65cf7a17fa 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -392,7 +392,7 @@ necessary with our new implementation. However, it may happen that your application relied on these values, so here are alternative methods of accessing them: - - session_id: ``$session->session_id`` or ``session_id()`` (PHP’s built-in function) + - session_id: ``$session->session_id`` or ``session_id()`` (PHP's built-in function) - ip_address: ``$_SERVER['REMOTE_ADDR']`` - user_agent: ``$_SERVER['HTTP_USER_AGENT']`` (unused by sessions) - last_activity: Depends on the storage, no straightforward way. Sorry! diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index 762ce8e200ef..1e25b4dae583 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -111,7 +111,7 @@ When you want to redirect back, use ``redirect()->back()``: .. note:: ``redirect()->back()`` is not the same as browser "back" button. It takes a visitor to "the last page viewed during the Session" when the Session is available. - If the Session hasn’t been loaded, or is otherwise unavailable, then a sanitized version of HTTP_REFERER will be used. + If the Session hasn't been loaded, or is otherwise unavailable, then a sanitized version of HTTP_REFERER will be used. .. _response-redirect-status-code: From daf48bbfd58b6072bb1954a6f8fb51f6e58f9400 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 27 Jul 2023 12:02:08 +0800 Subject: [PATCH 234/237] Add types for app --- app/Config/Kint.php | 18 ++++++++++++++++++ app/Controllers/BaseController.php | 2 +- app/Controllers/Home.php | 2 +- phpstan-baseline.php | 25 ------------------------- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/app/Config/Kint.php b/app/Config/Kint.php index 7e0a0157c065..cc8b54592b6b 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -3,7 +3,10 @@ namespace Config; use CodeIgniter\Config\BaseConfig; +use Kint\Parser\ConstructablePluginInterface; use Kint\Renderer\AbstractRenderer; +use Kint\Renderer\Rich\TabPluginInterface; +use Kint\Renderer\Rich\ValuePluginInterface; /** * -------------------------------------------------------------------------- @@ -23,7 +26,12 @@ class Kint extends BaseConfig |-------------------------------------------------------------------------- */ + /** + * @var array + * @phpstan-var list|ConstructablePluginInterface> + */ public $plugins; + public int $maxDepth = 6; public bool $displayCalledFrom = true; public bool $expanded = false; @@ -36,7 +44,17 @@ class Kint extends BaseConfig public string $richTheme = 'aante-light.css'; public bool $richFolder = false; public int $richSort = AbstractRenderer::SORT_FULL; + + /** + * @var array + * @phpstan-var array> + */ public $richObjectPlugins; + + /** + * @var array + * @phpstan-var array> + */ public $richTabPlugins; /* diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index ecea16206654..fb44007e5c72 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -44,7 +44,7 @@ abstract class BaseController extends Controller // protected $session; /** - * Constructor. + * @return void */ public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 7f867e95ffc4..59343333099a 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -4,7 +4,7 @@ class Home extends BaseController { - public function index() + public function index(): string { return view('welcome_message'); } diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 26a2bbdf1afb..6df649cb8bdc 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,31 +1,6 @@ '#^Property Config\\\\Kint\\:\\:\\$plugins has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Config/Kint.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Config\\\\Kint\\:\\:\\$richObjectPlugins has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Config/Kint.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Config\\\\Kint\\:\\:\\$richTabPlugins has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Config/Kint.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method App\\\\Controllers\\\\BaseController\\:\\:initController\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Controllers/BaseController.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method App\\\\Controllers\\\\Home\\:\\:index\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Controllers/Home.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:discoverComposerNamespaces\\(\\) has no return type specified\\.$#', 'count' => 1, From 68a090758950c3e18274efc7619897dff7097182 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 29 Jul 2023 20:45:23 +0800 Subject: [PATCH 235/237] Add types to Autoloader --- phpstan-baseline.php | 10 ---------- system/Autoloader/Autoloader.php | 4 ++++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 6df649cb8bdc..5302862f143a 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,16 +1,6 @@ '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:discoverComposerNamespaces\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Autoloader\\\\Autoloader\\:\\:register\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Autoloader/Autoloader.php', -]; $ignoreErrors[] = [ 'message' => '#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(CodeIgniter\\\\Autoloader\\\\Autoloader\\), \'loadClass\'\\} given\\.$#', 'count' => 1, diff --git a/system/Autoloader/Autoloader.php b/system/Autoloader/Autoloader.php index f838451ce6fb..65be3d7d3cee 100644 --- a/system/Autoloader/Autoloader.php +++ b/system/Autoloader/Autoloader.php @@ -148,6 +148,8 @@ private function loadComposerInfo(Modules $modules): void /** * Register the loader with the SPL autoloader stack. + * + * @return void */ public function register() { @@ -445,6 +447,8 @@ private function loadComposerClassmap(ClassLoader $composer): void * Locates autoload information from Composer, if available. * * @deprecated No longer used. + * + * @return void */ protected function discoverComposerNamespaces() { From 361cb3f27780b9633b7fe11ecb3dfb65e2664198 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sat, 29 Jul 2023 22:59:04 +0800 Subject: [PATCH 236/237] Add void return to tests --- tests/_support/Commands/AppInfo.php | 6 +- tests/_support/Commands/InvalidCommand.php | 2 +- tests/_support/Commands/LanguageCommand.php | 2 +- tests/_support/Commands/ParamsReveal.php | 2 +- tests/_support/Commands/Unsuffixable.php | 2 +- tests/_support/Controllers/Popcorn.php | 6 +- .../20160428212500_Create_test_tables.php | 4 +- .../_support/Database/Seeds/AnotherSeeder.php | 2 +- .../_support/Database/Seeds/CITestSeeder.php | 2 +- tests/_support/Filters/Customfilter.php | 2 +- .../2018-01-24-102301_Some_migration.php | 4 +- .../2018-01-24-102302_Another_migration.php | 4 +- tests/_support/Publishers/TestPublisher.php | 2 +- tests/_support/View/Cells/AdditionCell.php | 2 +- .../View/SampleClassWithInitController.php | 2 +- tests/system/API/ResponseTraitTest.php | 62 ++--- tests/system/Autoloader/AutoloaderTest.php | 52 ++-- tests/system/Autoloader/FileLocatorTest.php | 60 ++-- tests/system/CLI/CLITest.php | 74 ++--- tests/system/CLI/ConsoleTest.php | 16 +- tests/system/Cache/CacheFactoryTest.php | 10 +- tests/system/Cache/CacheMockTest.php | 4 +- .../Cache/Handlers/AbstractHandlerTest.php | 4 +- .../system/Cache/Handlers/BaseHandlerTest.php | 12 +- .../Cache/Handlers/DummyHandlerTest.php | 24 +- .../system/Cache/Handlers/FileHandlerTest.php | 36 +-- .../Cache/Handlers/MemcachedHandlerTest.php | 26 +- .../Cache/Handlers/PredisHandlerTest.php | 24 +- .../Cache/Handlers/RedisHandlerTest.php | 26 +- tests/system/CodeIgniterTest.php | 72 ++--- tests/system/Commands/BaseCommandTest.php | 8 +- tests/system/Commands/ClearCacheTest.php | 4 +- tests/system/Commands/ClearDebugbarTest.php | 4 +- tests/system/Commands/ClearLogsTest.php | 4 +- .../system/Commands/CommandGeneratorTest.php | 12 +- tests/system/Commands/CommandTest.php | 22 +- tests/system/Commands/ConfigGeneratorTest.php | 4 +- .../Commands/ConfigurableSortImportsTest.php | 6 +- .../Commands/ControllerGeneratorTest.php | 10 +- tests/system/Commands/CreateDatabaseTest.php | 6 +- .../system/Commands/DatabaseCommandsTest.php | 10 +- tests/system/Commands/EntityGeneratorTest.php | 4 +- .../Commands/EnvironmentCommandTest.php | 2 +- tests/system/Commands/FilterCheckTest.php | 4 +- tests/system/Commands/FilterGeneratorTest.php | 4 +- tests/system/Commands/GenerateKeyTest.php | 14 +- tests/system/Commands/GeneratorsTest.php | 12 +- tests/system/Commands/HelpCommandTest.php | 10 +- tests/system/Commands/InfoCacheTest.php | 8 +- .../Commands/MigrationGeneratorTest.php | 8 +- tests/system/Commands/ModelGeneratorTest.php | 16 +- tests/system/Commands/PublishCommandTest.php | 4 +- tests/system/Commands/RoutesTest.php | 8 +- .../system/Commands/ScaffoldGeneratorTest.php | 10 +- tests/system/Commands/SeederGeneratorTest.php | 4 +- .../Commands/Utilities/NamespacesTest.php | 4 +- .../Routes/AutoRouteCollectorTest.php | 2 +- .../AutoRouteCollectorTest.php | 4 +- .../ControllerMethodReaderTest.php | 6 +- .../AutoRouterImproved/Controllers/Home.php | 6 +- .../Utilities/Routes/ControllerFinderTest.php | 2 +- .../Routes/ControllerMethodReaderTest.php | 4 +- .../Utilities/Routes/FilterCollectorTest.php | 2 +- .../Utilities/Routes/FilterFinderTest.php | 10 +- .../Routes/SampleURIGeneratorTest.php | 4 +- .../Commands/ValidationGeneratorTest.php | 4 +- tests/system/CommonFunctionsSendTest.php | 2 +- tests/system/CommonFunctionsTest.php | 118 ++++---- tests/system/CommonHelperTest.php | 4 +- tests/system/Config/BaseConfigTest.php | 36 +-- tests/system/Config/ConfigTest.php | 10 +- tests/system/Config/DotEnvTest.php | 30 +- tests/system/Config/FactoriesTest.php | 50 ++-- tests/system/Config/MimesTest.php | 4 +- tests/system/Config/ServicesTest.php | 94 +++---- tests/system/ControllerTest.php | 18 +- tests/system/Database/BaseConnectionTest.php | 22 +- tests/system/Database/BaseQueryTest.php | 68 ++--- tests/system/Database/Builder/AliasTest.php | 12 +- tests/system/Database/Builder/BaseTest.php | 8 +- tests/system/Database/Builder/CountTest.php | 12 +- tests/system/Database/Builder/DeleteTest.php | 8 +- .../system/Database/Builder/DistinctTest.php | 2 +- tests/system/Database/Builder/EmptyTest.php | 2 +- tests/system/Database/Builder/FromTest.php | 16 +- tests/system/Database/Builder/GetTest.php | 12 +- tests/system/Database/Builder/GroupTest.php | 62 ++--- tests/system/Database/Builder/InsertTest.php | 24 +- tests/system/Database/Builder/JoinTest.php | 14 +- tests/system/Database/Builder/LikeTest.php | 20 +- tests/system/Database/Builder/LimitTest.php | 6 +- tests/system/Database/Builder/OrderTest.php | 8 +- tests/system/Database/Builder/PrefixTest.php | 4 +- tests/system/Database/Builder/ReplaceTest.php | 4 +- tests/system/Database/Builder/SelectTest.php | 50 ++-- .../system/Database/Builder/TruncateTest.php | 2 +- tests/system/Database/Builder/UpdateTest.php | 36 +-- tests/system/Database/Builder/WhenTest.php | 44 +-- tests/system/Database/Builder/WhereTest.php | 78 +++--- tests/system/Database/ConfigTest.php | 10 +- tests/system/Database/DatabaseSeederTest.php | 8 +- .../DatabaseTestCaseMigrationOnce1Test.php | 6 +- .../DatabaseTestCaseMigrationOnce2Test.php | 4 +- .../system/Database/DatabaseTestCaseTest.php | 6 +- .../system/Database/Forge/CreateTableTest.php | 2 +- .../Database/Forge/DropForeignKeyTest.php | 2 +- tests/system/Database/Live/AliasTest.php | 2 +- tests/system/Database/Live/BadQueryTest.php | 4 +- tests/system/Database/Live/ConnectTest.php | 8 +- tests/system/Database/Live/CountTest.php | 10 +- .../Live/DatabaseTestTraitCaseTest.php | 10 +- tests/system/Database/Live/DbDebugTest.php | 4 +- tests/system/Database/Live/DbUtilsTest.php | 26 +- tests/system/Database/Live/DeleteTest.php | 12 +- tests/system/Database/Live/EmptyTest.php | 4 +- tests/system/Database/Live/EscapeTest.php | 12 +- .../Database/Live/FabricatorLiveTest.php | 14 +- tests/system/Database/Live/ForgeTest.php | 90 +++--- tests/system/Database/Live/FromTest.php | 6 +- tests/system/Database/Live/GetNumRowsTest.php | 2 +- tests/system/Database/Live/GetTest.php | 34 +-- tests/system/Database/Live/GetVersionTest.php | 2 +- tests/system/Database/Live/GroupTest.php | 40 +-- tests/system/Database/Live/IncrementTest.php | 12 +- tests/system/Database/Live/InsertTest.php | 20 +- tests/system/Database/Live/JoinTest.php | 2 +- tests/system/Database/Live/LikeTest.php | 22 +- tests/system/Database/Live/LimitTest.php | 4 +- tests/system/Database/Live/MetadataTest.php | 6 +- .../Database/Live/MySQLi/RawSqlTest.php | 14 +- .../Live/OCI8/CallStoredProcedureTest.php | 6 +- .../Database/Live/OCI8/LastInsertIDTest.php | 8 +- tests/system/Database/Live/OrderTest.php | 8 +- .../Database/Live/PreparedQueryTest.php | 22 +- tests/system/Database/Live/PretendTest.php | 2 +- .../Database/Live/SQLite/AlterTableTest.php | 20 +- .../Database/Live/SQLite/GetIndexDataTest.php | 2 +- tests/system/Database/Live/SelectTest.php | 34 +-- .../Live/TransactionDBDebugFalseTest.php | 2 +- .../Live/TransactionDBDebugTrueTest.php | 10 +- .../system/Database/Live/TransactionTest.php | 8 +- tests/system/Database/Live/UpdateTest.php | 38 +-- tests/system/Database/Live/UpsertTest.php | 38 +-- tests/system/Database/Live/WhereTest.php | 28 +- .../Database/Live/WriteTypeQueryTest.php | 38 +-- .../Migrations/MigrationRunnerTest.php | 56 ++-- .../Database/Migrations/MigrationTest.php | 6 +- tests/system/Database/ModelFactoryTest.php | 10 +- tests/system/Database/RawSqlTest.php | 6 +- tests/system/Debug/TimerTest.php | 42 +-- .../Debug/Toolbar/Collectors/HistoryTest.php | 4 +- tests/system/Email/EmailTest.php | 20 +- tests/system/Encryption/EncryptionTest.php | 30 +- .../Handlers/OpenSSLHandlerTest.php | 14 +- .../Encryption/Handlers/SodiumHandlerTest.php | 16 +- tests/system/Entity/EntityTest.php | 152 +++++------ tests/system/Events/EventsTest.php | 62 ++--- tests/system/Files/FileCollectionTest.php | 82 +++--- tests/system/Files/FileTest.php | 20 +- tests/system/Files/FileWithVfsTest.php | 28 +- tests/system/Filters/CSRFTest.php | 4 +- tests/system/Filters/DebugToolbarTest.php | 2 +- tests/system/Filters/FiltersTest.php | 74 ++--- tests/system/Filters/HoneypotTest.php | 8 +- tests/system/Filters/InvalidCharsTest.php | 12 +- tests/system/Filters/SecureHeadersTest.php | 2 +- .../system/Filters/fixtures/GoogleCurious.php | 2 +- tests/system/Filters/fixtures/GoogleEmpty.php | 2 +- tests/system/Filters/fixtures/GoogleYou.php | 2 +- tests/system/Filters/fixtures/Multiple1.php | 2 +- tests/system/Filters/fixtures/Multiple2.php | 2 +- tests/system/Format/FormatTest.php | 10 +- tests/system/Format/JSONFormatterTest.php | 8 +- tests/system/Format/XMLFormatterTest.php | 14 +- tests/system/HTTP/CLIRequestTest.php | 78 +++--- .../HTTP/CURLRequestDoNotShareOptionsTest.php | 122 ++++----- tests/system/HTTP/CURLRequestTest.php | 122 ++++----- .../system/HTTP/ContentSecurityPolicyTest.php | 76 +++--- tests/system/HTTP/DownloadResponseTest.php | 52 ++-- .../system/HTTP/Files/FileCollectionTest.php | 50 ++-- tests/system/HTTP/Files/FileMovingTest.php | 18 +- tests/system/HTTP/HeaderTest.php | 30 +- .../HTTP/IncomingRequestDetectingTest.php | 28 +- tests/system/HTTP/IncomingRequestTest.php | 152 +++++------ tests/system/HTTP/MessageTest.php | 50 ++-- tests/system/HTTP/NegotiateTest.php | 34 +-- tests/system/HTTP/OutgoingRequestTest.php | 14 +- tests/system/HTTP/RedirectResponseTest.php | 30 +- tests/system/HTTP/RequestTest.php | 60 ++-- tests/system/HTTP/ResponseCookieTest.php | 36 +-- tests/system/HTTP/ResponseSendTest.php | 6 +- tests/system/HTTP/ResponseTest.php | 78 +++--- tests/system/HTTP/URITest.php | 134 ++++----- tests/system/HTTP/UserAgentTest.php | 16 +- tests/system/Helpers/ArrayHelperTest.php | 40 +-- tests/system/Helpers/CookieHelperTest.php | 30 +- tests/system/Helpers/DateHelperTest.php | 10 +- tests/system/Helpers/FilesystemHelperTest.php | 76 +++--- tests/system/Helpers/FormHelperTest.php | 134 ++++----- tests/system/Helpers/HTMLHelperTest.php | 122 ++++----- tests/system/Helpers/InflectorHelperTest.php | 24 +- tests/system/Helpers/NumberHelperTest.php | 38 +-- tests/system/Helpers/SecurityHelperTest.php | 8 +- tests/system/Helpers/TextHelperTest.php | 60 ++-- .../Helpers/URLHelper/CurrentUrlTest.php | 30 +- .../system/Helpers/URLHelper/MiscUrlTest.php | 52 ++-- .../system/Helpers/URLHelper/SiteUrlTest.php | 16 +- tests/system/Helpers/XMLHelperTest.php | 4 +- tests/system/HomeTest.php | 2 +- tests/system/Honeypot/HoneypotTest.php | 24 +- tests/system/I18n/TimeDifferenceTest.php | 48 ++-- tests/system/I18n/TimeLegacyTest.php | 256 ++++++++--------- tests/system/I18n/TimeTest.php | 258 +++++++++--------- tests/system/Images/BaseHandlerTest.php | 14 +- tests/system/Images/GDHandlerTest.php | 70 ++--- .../system/Images/ImageMagickHandlerTest.php | 70 ++--- tests/system/Images/ImageTest.php | 14 +- tests/system/Language/LanguageTest.php | 42 +-- .../Log/Handlers/ChromeLoggerHandlerTest.php | 10 +- tests/system/Log/Handlers/FileHandlerTest.php | 8 +- tests/system/Log/LoggerTest.php | 48 ++-- .../system/Models/MiscellaneousModelTest.php | 2 +- .../Models/ValidationModelRuleGroupTest.php | 6 +- tests/system/Models/ValidationModelTest.php | 6 +- tests/system/Pager/PagerRendererTest.php | 62 ++--- tests/system/Pager/PagerTest.php | 78 +++--- .../Publisher/PublisherContentReplaceTest.php | 6 +- tests/system/Publisher/PublisherInputTest.php | 16 +- .../system/Publisher/PublisherOutputTest.php | 18 +- .../Publisher/PublisherRestrictionsTest.php | 8 +- .../system/Publisher/PublisherSupportTest.php | 20 +- .../system/RESTful/ResourceControllerTest.php | 30 +- .../system/RESTful/ResourcePresenterTest.php | 28 +- .../system/Router/AutoRouterImprovedTest.php | 36 +-- .../Dash_folder/Dash_controller.php | 4 +- .../Router/Controllers/Dash_folder/Home.php | 2 +- .../Controllers/Dash_folder/Mycontroller.php | 2 +- tests/system/Router/Controllers/Home.php | 4 +- tests/system/Router/Controllers/Index.php | 4 +- .../Router/Controllers/Mycontroller.php | 4 +- .../Controllers/Subfolder/Mycontroller.php | 2 +- .../RouteCollectionReverseRouteTest.php | 28 +- tests/system/Router/RouteCollectionTest.php | 256 ++++++++--------- tests/system/Router/RouterTest.php | 110 ++++---- .../SecurityCSRFCookieRandomizeTokenTest.php | 4 +- .../SecurityCSRFSessionRandomizeTokenTest.php | 26 +- .../Security/SecurityCSRFSessionTest.php | 22 +- tests/system/Security/SecurityTest.php | 28 +- .../Database/AbstractHandlerTestCase.php | 12 +- .../Handlers/Database/RedisHandlerTest.php | 22 +- tests/system/Session/SessionTest.php | 84 +++--- tests/system/SparkTest.php | 2 +- tests/system/Test/BootstrapFCPATHTest.php | 2 +- tests/system/Test/ControllerTestTraitTest.php | 38 +-- tests/system/Test/DOMParserTest.php | 72 ++--- tests/system/Test/FabricatorTest.php | 94 +++---- .../FeatureTestAutoRoutingImprovedTest.php | 6 +- tests/system/Test/FeatureTestTraitTest.php | 58 ++-- tests/system/Test/FilterTestTraitTest.php | 18 +- tests/system/Test/ReflectionHelperTest.php | 14 +- tests/system/Test/TestCaseEmissionsTest.php | 4 +- tests/system/Test/TestCaseTest.php | 20 +- tests/system/Test/TestResponseTest.php | 76 +++--- tests/system/Throttle/ThrottleTest.php | 20 +- tests/system/Typography/TypographyTest.php | 18 +- tests/system/Validation/FormatRulesTest.php | 6 +- tests/system/Validation/ValidationTest.php | 34 +-- tests/system/View/CellTest.php | 50 ++-- tests/system/View/ControlledCellTest.php | 34 +-- tests/system/View/DecoratorsTest.php | 10 +- tests/system/View/ParserFilterTest.php | 52 ++-- tests/system/View/ParserPluginTest.php | 22 +- tests/system/View/ParserTest.php | 126 ++++----- tests/system/View/TableTest.php | 52 ++-- tests/system/View/ViewTest.php | 60 ++-- 275 files changed, 3769 insertions(+), 3769 deletions(-) diff --git a/tests/_support/Commands/AppInfo.php b/tests/_support/Commands/AppInfo.php index e7bf3093e658..efb6d941a953 100644 --- a/tests/_support/Commands/AppInfo.php +++ b/tests/_support/Commands/AppInfo.php @@ -23,12 +23,12 @@ class AppInfo extends BaseCommand protected $arguments = ['draft' => 'unused']; protected $description = 'Displays basic application information.'; - public function run(array $params) + public function run(array $params): void { CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); } - public function bomb() + public function bomb(): void { try { CLI::color('test', 'white', 'Background'); @@ -37,7 +37,7 @@ public function bomb() } } - public function helpme() + public function helpme(): void { $this->call('help'); } diff --git a/tests/_support/Commands/InvalidCommand.php b/tests/_support/Commands/InvalidCommand.php index 5b4acf936b08..e69827669290 100644 --- a/tests/_support/Commands/InvalidCommand.php +++ b/tests/_support/Commands/InvalidCommand.php @@ -27,7 +27,7 @@ public function __construct() throw new ReflectionException(); } - public function run(array $params) + public function run(array $params): void { CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); } diff --git a/tests/_support/Commands/LanguageCommand.php b/tests/_support/Commands/LanguageCommand.php index e495d250a295..978099e5257f 100644 --- a/tests/_support/Commands/LanguageCommand.php +++ b/tests/_support/Commands/LanguageCommand.php @@ -27,7 +27,7 @@ class LanguageCommand extends BaseCommand '--sort' => 'Turn on/off the sortImports flag.', ]; - public function run(array $params) + public function run(array $params): void { $this->setHasClassName(false); $params[0] = 'Foobar'; diff --git a/tests/_support/Commands/ParamsReveal.php b/tests/_support/Commands/ParamsReveal.php index 76be444e69d1..331c1471611f 100644 --- a/tests/_support/Commands/ParamsReveal.php +++ b/tests/_support/Commands/ParamsReveal.php @@ -21,7 +21,7 @@ class ParamsReveal extends BaseCommand protected $description = 'Reveal params'; public static $args; - public function run(array $params) + public function run(array $params): void { static::$args = $params; } diff --git a/tests/_support/Commands/Unsuffixable.php b/tests/_support/Commands/Unsuffixable.php index 36a752e25891..cf906071d7ef 100644 --- a/tests/_support/Commands/Unsuffixable.php +++ b/tests/_support/Commands/Unsuffixable.php @@ -65,7 +65,7 @@ class Unsuffixable extends BaseCommand /** * Actually execute a command. */ - public function run(array $params) + public function run(array $params): void { $this->component = 'Command'; $this->directory = 'Commands'; diff --git a/tests/_support/Controllers/Popcorn.php b/tests/_support/Controllers/Popcorn.php index 660a405cccc2..2084c3b81713 100644 --- a/tests/_support/Controllers/Popcorn.php +++ b/tests/_support/Controllers/Popcorn.php @@ -33,7 +33,7 @@ public function pop() return $this->respond('Oops', 567, 'Surprise'); } - public function popper() + public function popper(): void { throw new RuntimeException('Surprise', 500); } @@ -61,12 +61,12 @@ public function index3() return $this->response->setJSON(['lang' => $this->request->getLocale()]); } - public function canyon() + public function canyon(): void { echo 'Hello-o-o ' . $this->request->getGet('foo'); } - public function cat() + public function cat(): void { } diff --git a/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php b/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php index ac489ecbb57b..6e3d9be574fa 100644 --- a/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php +++ b/tests/_support/Database/Migrations/20160428212500_Create_test_tables.php @@ -15,7 +15,7 @@ class Migration_Create_test_tables extends Migration { - public function up() + public function up(): void { // User Table $this->forge->addField([ @@ -160,7 +160,7 @@ public function up() } } - public function down() + public function down(): void { $this->forge->dropTable('user', true); $this->forge->dropTable('job', true); diff --git a/tests/_support/Database/Seeds/AnotherSeeder.php b/tests/_support/Database/Seeds/AnotherSeeder.php index aaf7c7e93410..09c9a93d8af8 100644 --- a/tests/_support/Database/Seeds/AnotherSeeder.php +++ b/tests/_support/Database/Seeds/AnotherSeeder.php @@ -15,7 +15,7 @@ class AnotherSeeder extends Seeder { - public function run() + public function run(): void { $row = [ 'name' => 'Jerome Lohan', diff --git a/tests/_support/Database/Seeds/CITestSeeder.php b/tests/_support/Database/Seeds/CITestSeeder.php index 9353578246b5..1749970fe338 100644 --- a/tests/_support/Database/Seeds/CITestSeeder.php +++ b/tests/_support/Database/Seeds/CITestSeeder.php @@ -15,7 +15,7 @@ class CITestSeeder extends Seeder { - public function run() + public function run(): void { // Job Data $data = [ diff --git a/tests/_support/Filters/Customfilter.php b/tests/_support/Filters/Customfilter.php index 7efbb6c0ddb8..6804cacf62b4 100644 --- a/tests/_support/Filters/Customfilter.php +++ b/tests/_support/Filters/Customfilter.php @@ -23,7 +23,7 @@ public function before(RequestInterface $request, $arguments = null) return $request; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void { } } diff --git a/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php b/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php index 39eb6e0879cc..e0a34f3eb03c 100644 --- a/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php +++ b/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php @@ -13,7 +13,7 @@ class Migration_some_migration extends \CodeIgniter\Database\Migration { - public function up() + public function up(): void { $this->forge->addField([ 'key' => [ @@ -28,7 +28,7 @@ public function up() ]); } - public function down() + public function down(): void { $this->forge->dropTable('foo', true); } diff --git a/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php b/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php index f1606eff56e1..0006da2a347d 100644 --- a/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php +++ b/tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php @@ -13,7 +13,7 @@ class Migration_another_migration extends \CodeIgniter\Database\Migration { - public function up() + public function up(): void { $fields = [ 'value' => [ @@ -29,7 +29,7 @@ public function up() ]); } - public function down() + public function down(): void { if ($this->db->tableExists('foo')) { $this->forge->dropColumn('foo', 'value'); diff --git a/tests/_support/Publishers/TestPublisher.php b/tests/_support/Publishers/TestPublisher.php index 95d9fa72c250..0e3b67ab23a5 100644 --- a/tests/_support/Publishers/TestPublisher.php +++ b/tests/_support/Publishers/TestPublisher.php @@ -39,7 +39,7 @@ final class TestPublisher extends Publisher /** * Fakes an error on the given file. */ - public static function setResult(bool $result) + public static function setResult(bool $result): void { self::$result = $result; } diff --git a/tests/_support/View/Cells/AdditionCell.php b/tests/_support/View/Cells/AdditionCell.php index aaa89a6560cb..0b5b8a5ddc74 100644 --- a/tests/_support/View/Cells/AdditionCell.php +++ b/tests/_support/View/Cells/AdditionCell.php @@ -17,7 +17,7 @@ class AdditionCell extends Cell { public int $value = 2; - public function mount(?int $number = null, bool $skipAddition = false) + public function mount(?int $number = null, bool $skipAddition = false): void { $this->value = ! $skipAddition ? $this->value + (int) $number diff --git a/tests/_support/View/SampleClassWithInitController.php b/tests/_support/View/SampleClassWithInitController.php index 32eb4f70a7a3..8b12326c5b58 100644 --- a/tests/_support/View/SampleClassWithInitController.php +++ b/tests/_support/View/SampleClassWithInitController.php @@ -25,7 +25,7 @@ class SampleClassWithInitController { private ResponseInterface $response; - public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) + public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger): void { $this->response = $response; } diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index b8a522da86dd..693eff53f33d 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -95,14 +95,14 @@ public function __construct(&$request, &$response, &$formatter) $this->formatter = $formatter; } - public function resetFormatter() + public function resetFormatter(): void { $this->formatter = null; } }; } - public function testNoFormatterJSON() + public function testNoFormatterJSON(): void { $this->formatter = null; $controller = $this->makeController([], 'http://codeigniter.com', ['Accept' => 'application/json']); @@ -120,7 +120,7 @@ public function testNoFormatterJSON() $this->assertSame($expected, $this->response->getBody()); } - public function testNoFormatter() + public function testNoFormatter(): void { $this->formatter = null; $controller = $this->makeController([], 'http://codeigniter.com', ['Accept' => 'application/json']); @@ -130,7 +130,7 @@ public function testNoFormatter() $this->assertSame('A Custom Reason', $this->response->getBody()); } - public function testAssociativeArrayPayload() + public function testAssociativeArrayPayload(): void { $this->formatter = null; $controller = $this->makeController(); @@ -146,7 +146,7 @@ public function testAssociativeArrayPayload() $this->assertSame($expected, $this->response->getBody()); } - public function testArrayPayload() + public function testArrayPayload(): void { $this->formatter = null; $controller = $this->makeController(); @@ -168,7 +168,7 @@ public function testArrayPayload() $this->assertSame($expected, $this->response->getBody()); } - public function testPHPtoArrayPayload() + public function testPHPtoArrayPayload(): void { $this->formatter = null; $controller = $this->makeController(); @@ -187,7 +187,7 @@ public function testPHPtoArrayPayload() $this->assertSame($expected, $this->response->getBody()); } - public function testRespondSets404WithNoData() + public function testRespondSets404WithNoData(): void { $controller = $this->makeController(); @@ -197,7 +197,7 @@ public function testRespondSets404WithNoData() $this->assertNull($this->response->getBody()); } - public function testRespondSetsStatusWithEmptyData() + public function testRespondSetsStatusWithEmptyData(): void { $controller = $this->makeController(); @@ -207,7 +207,7 @@ public function testRespondSetsStatusWithEmptyData() $this->assertNull($this->response->getBody()); } - public function testRespondSetsCorrectBodyAndStatus() + public function testRespondSetsCorrectBodyAndStatus(): void { $controller = $this->makeController(); @@ -219,7 +219,7 @@ public function testRespondSetsCorrectBodyAndStatus() $this->assertSame('Created', $this->response->getReason()); } - public function testRespondWithCustomReason() + public function testRespondWithCustomReason(): void { $controller = $this->makeController(); @@ -229,7 +229,7 @@ public function testRespondWithCustomReason() $this->assertSame('A Custom Reason', $this->response->getReason()); } - public function testFailSingleMessage() + public function testFailSingleMessage(): void { $controller = $this->makeController(); @@ -248,7 +248,7 @@ public function testFailSingleMessage() $this->assertSame('A Custom Reason', $this->response->getReason()); } - public function testCreated() + public function testCreated(): void { $controller = $this->makeController(); @@ -259,7 +259,7 @@ public function testCreated() $this->assertSame($this->formatter->format(['id' => 3]), $this->response->getBody()); } - public function testDeleted() + public function testDeleted(): void { $controller = $this->makeController(); @@ -270,7 +270,7 @@ public function testDeleted() $this->assertSame($this->formatter->format(['id' => 3]), $this->response->getBody()); } - public function testUpdated() + public function testUpdated(): void { $controller = $this->makeController(); @@ -281,7 +281,7 @@ public function testUpdated() $this->assertSame($this->formatter->format(['id' => 3]), $this->response->getBody()); } - public function testUnauthorized() + public function testUnauthorized(): void { $controller = $this->makeController(); @@ -299,7 +299,7 @@ public function testUnauthorized() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testForbidden() + public function testForbidden(): void { $controller = $this->makeController(); @@ -317,7 +317,7 @@ public function testForbidden() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testNoContent() + public function testNoContent(): void { $controller = $this->makeController(); @@ -328,7 +328,7 @@ public function testNoContent() $this->assertSame(204, $this->response->getStatusCode()); } - public function testNotFound() + public function testNotFound(): void { $controller = $this->makeController(); @@ -346,7 +346,7 @@ public function testNotFound() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testValidationError() + public function testValidationError(): void { $controller = $this->makeController(); @@ -364,7 +364,7 @@ public function testValidationError() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testValidationErrors() + public function testValidationErrors(): void { $controller = $this->makeController(); @@ -383,7 +383,7 @@ public function testValidationErrors() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testResourceExists() + public function testResourceExists(): void { $controller = $this->makeController(); @@ -401,7 +401,7 @@ public function testResourceExists() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testResourceGone() + public function testResourceGone(): void { $controller = $this->makeController(); @@ -419,7 +419,7 @@ public function testResourceGone() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testTooManyRequests() + public function testTooManyRequests(): void { $controller = $this->makeController(); @@ -437,7 +437,7 @@ public function testTooManyRequests() $this->assertSame($this->formatter->format($expected), $this->response->getBody()); } - public function testServerError() + public function testServerError(): void { $controller = $this->makeController(); @@ -454,7 +454,7 @@ public function testServerError() ]), $this->response->getBody()); } - public function testValidContentTypes() + public function testValidContentTypes(): void { $chars = '; charset=UTF-8'; $goodMimes = [ @@ -469,7 +469,7 @@ public function testValidContentTypes() } } - private function tryValidContentType($mimeType, $contentType) + private function tryValidContentType($mimeType, $contentType): void { $original = $_SERVER; $_SERVER['CONTENT_TYPE'] = $mimeType; @@ -482,7 +482,7 @@ private function tryValidContentType($mimeType, $contentType) $_SERVER = $original; } - public function testValidResponses() + public function testValidResponses(): void { $chars = '; charset=UTF-8'; $goodMimes = [ @@ -497,7 +497,7 @@ public function testValidResponses() } } - public function testXMLFormatter() + public function testXMLFormatter(): void { $this->formatter = new XMLFormatter(); $controller = $this->makeController(); @@ -514,7 +514,7 @@ public function testXMLFormatter() $this->assertSame($expected, $this->response->getBody()); } - public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML() + public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML(): void { $config = new App(); @@ -559,7 +559,7 @@ public function __construct(&$request, &$response) $this->assertStringStartsWith(config('Format')->supportedResponseFormats[0], $response->getHeaderLine('Content-Type')); } - public function testResponseFormat() + public function testResponseFormat(): void { $data = ['foo' => 'something']; $controller = $this->makeController(); @@ -576,7 +576,7 @@ public function testResponseFormat() $this->assertStringStartsWith('application/xml', $this->response->getHeaderLine('Content-Type')); } - public function testXMLResponseFormat() + public function testXMLResponseFormat(): void { $data = ['foo' => 'bar']; $controller = $this->makeController(); diff --git a/tests/system/Autoloader/AutoloaderTest.php b/tests/system/Autoloader/AutoloaderTest.php index bfe7a0fac8da..a116bc9515d6 100644 --- a/tests/system/Autoloader/AutoloaderTest.php +++ b/tests/system/Autoloader/AutoloaderTest.php @@ -59,12 +59,12 @@ protected function tearDown(): void parent::tearDown(); } - public function testLoadStoredClass() + public function testLoadStoredClass(): void { $this->assertInstanceOf('UnnamespacedClass', new UnnamespacedClass()); } - public function testInitializeWithInvalidArguments() + public function testInitializeWithInvalidArguments(): void { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage("Config array must contain either the 'psr4' key or the 'classmap' key."); @@ -78,7 +78,7 @@ public function testInitializeWithInvalidArguments() (new Autoloader())->initialize($config, $modules); } - public function testInitializeTwice() + public function testInitializeTwice(): void { $loader = new Autoloader(); $loader->initialize(new Autoload(), new Modules()); @@ -94,7 +94,7 @@ public function testInitializeTwice() $this->assertSame('ROOTPATH/app', clean_path($ns['App'][0])); } - public function testServiceAutoLoaderFromShareInstances() + public function testServiceAutoLoaderFromShareInstances(): void { $autoloader = Services::autoloader(); // look for Home controller, as that should be in base repo @@ -103,7 +103,7 @@ public function testServiceAutoLoaderFromShareInstances() $this->assertSame($expected, realpath($actual) ?: $actual); } - public function testServiceAutoLoader() + public function testServiceAutoLoader(): void { $autoloader = Services::autoloader(false); $autoloader->initialize(new Autoload(), new Modules()); @@ -117,7 +117,7 @@ public function testServiceAutoLoader() $autoloader->unregister(); } - public function testExistingFile() + public function testExistingFile(): void { $actual = $this->loader->loadClass(Home::class); $expected = APPPATH . 'Controllers' . DIRECTORY_SEPARATOR . 'Home.php'; @@ -128,26 +128,26 @@ public function testExistingFile() $this->assertSame($expected, $actual); } - public function testMatchesWithPrecedingSlash() + public function testMatchesWithPrecedingSlash(): void { $actual = $this->loader->loadClass(Home::class); $expected = APPPATH . 'Controllers' . DIRECTORY_SEPARATOR . 'Home.php'; $this->assertSame($expected, $actual); } - public function testMatchesWithFileExtension() + public function testMatchesWithFileExtension(): void { $actual = $this->loader->loadClass('\App\Controllers\Home.php'); $expected = APPPATH . 'Controllers' . DIRECTORY_SEPARATOR . 'Home.php'; $this->assertSame($expected, $actual); } - public function testMissingFile() + public function testMissingFile(): void { $this->assertFalse($this->loader->loadClass('\App\Missing\Classname')); } - public function testAddNamespaceWorks() + public function testAddNamespaceWorks(): void { $this->assertFalse($this->loader->loadClass('My\App\Class')); @@ -159,7 +159,7 @@ public function testAddNamespaceWorks() $this->assertSame($expected, $actual); } - public function testAddNamespaceMultiplePathsWorks() + public function testAddNamespaceMultiplePathsWorks(): void { $this->loader->addNamespace([ 'My\App' => [ @@ -177,7 +177,7 @@ public function testAddNamespaceMultiplePathsWorks() $this->assertSame($expected, $actual); } - public function testAddNamespaceStringToArray() + public function testAddNamespaceStringToArray(): void { $this->loader->addNamespace('App\Controllers', __DIR__); @@ -187,7 +187,7 @@ public function testAddNamespaceStringToArray() ); } - public function testGetNamespaceGivesArray() + public function testGetNamespaceGivesArray(): void { $this->assertSame([ 'App' => [APPPATH], @@ -198,7 +198,7 @@ public function testGetNamespaceGivesArray() $this->assertSame([], $this->loader->getNamespace('Foo')); } - public function testRemoveNamespace() + public function testRemoveNamespace(): void { $this->loader->addNamespace('My\App', __DIR__); $this->assertSame(__FILE__, $this->loader->loadClass('My\App\AutoloaderTest')); @@ -207,12 +207,12 @@ public function testRemoveNamespace() $this->assertFalse((bool) $this->loader->loadClass('My\App\AutoloaderTest')); } - public function testloadClassNonNamespaced() + public function testloadClassNonNamespaced(): void { $this->assertFalse($this->loader->loadClass('Modules')); } - public function testSanitizationContailsSpecialChars() + public function testSanitizationContailsSpecialChars(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( @@ -224,7 +224,7 @@ public function testSanitizationContailsSpecialChars() $this->loader->sanitizeFilename($test); } - public function testSanitizationFilenameEdges() + public function testSanitizationFilenameEdges(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( @@ -236,7 +236,7 @@ public function testSanitizationFilenameEdges() $this->loader->sanitizeFilename($test); } - public function testSanitizationRegexError() + public function testSanitizationRegexError(): void { $this->expectException(RuntimeException::class); @@ -245,21 +245,21 @@ public function testSanitizationRegexError() $this->loader->sanitizeFilename($test); } - public function testSanitizationAllowUnicodeChars() + public function testSanitizationAllowUnicodeChars(): void { $test = 'Ä/path/to/some/file.php'; $this->assertSame($test, $this->loader->sanitizeFilename($test)); } - public function testSanitizationAllowsWindowsFilepaths() + public function testSanitizationAllowsWindowsFilepaths(): void { $test = 'C:\path\to\some/file.php'; $this->assertSame($test, $this->loader->sanitizeFilename($test)); } - public function testFindsComposerRoutes() + public function testFindsComposerRoutes(): void { $config = new Autoload(); $modules = new Modules(); @@ -272,7 +272,7 @@ public function testFindsComposerRoutes() $this->assertArrayHasKey('Laminas\\Escaper', $namespaces); } - public function testComposerNamespaceDoesNotOverwriteConfigAutoloadPsr4() + public function testComposerNamespaceDoesNotOverwriteConfigAutoloadPsr4(): void { $config = new Autoload(); $config->psr4 = [ @@ -289,7 +289,7 @@ public function testComposerNamespaceDoesNotOverwriteConfigAutoloadPsr4() $this->assertStringContainsString(VENDORPATH, $namespaces['Psr\Log'][1]); } - public function testComposerPackagesOnly() + public function testComposerPackagesOnly(): void { $config = new Autoload(); $config->psr4 = []; @@ -306,7 +306,7 @@ public function testComposerPackagesOnly() $this->assertStringContainsString(VENDORPATH, $namespaces['Laminas\Escaper'][0]); } - public function testComposerPackagesExclude() + public function testComposerPackagesExclude(): void { $config = new Autoload(); $config->psr4 = []; @@ -328,7 +328,7 @@ public function testComposerPackagesExclude() $this->assertArrayNotHasKey('Laminas\\Escaper', $namespaces); } - public function testComposerPackagesOnlyAndExclude() + public function testComposerPackagesOnlyAndExclude(): void { $this->expectException(ConfigException::class); $this->expectExceptionMessage('Cannot use "only" and "exclude" at the same time in "Config\Modules::$composerPackages".'); @@ -346,7 +346,7 @@ public function testComposerPackagesOnlyAndExclude() $loader->initialize($config, $modules); } - public function testFindsComposerRoutesWithComposerPathNotFound() + public function testFindsComposerRoutesWithComposerPathNotFound(): void { $composerPath = COMPOSER_PATH; diff --git a/tests/system/Autoloader/FileLocatorTest.php b/tests/system/Autoloader/FileLocatorTest.php index fc5f56a66d3b..1cf32cfa5ad1 100644 --- a/tests/system/Autoloader/FileLocatorTest.php +++ b/tests/system/Autoloader/FileLocatorTest.php @@ -51,7 +51,7 @@ protected function setUp(): void $this->locator = new FileLocator($autoloader); } - public function testLocateFileNotNamespacedFindsInAppDirectory() + public function testLocateFileNotNamespacedFindsInAppDirectory(): void { $file = 'Controllers/Home'; // not namespaced @@ -60,14 +60,14 @@ public function testLocateFileNotNamespacedFindsInAppDirectory() $this->assertSame($expected, $this->locator->locateFile($file)); } - public function testLocateFileNotNamespacedNotFound() + public function testLocateFileNotNamespacedNotFound(): void { $file = 'Unknown'; // not namespaced $this->assertFalse($this->locator->locateFile($file)); } - public function testLocateFileNotNamespacedFindsWithFolderInAppDirectory() + public function testLocateFileNotNamespacedFindsWithFolderInAppDirectory(): void { $file = 'welcome_message'; // not namespaced @@ -76,7 +76,7 @@ public function testLocateFileNotNamespacedFindsWithFolderInAppDirectory() $this->assertSame($expected, $this->locator->locateFile($file, 'Views')); } - public function testLocateFileNotNamespacedFindesWithoutFolderInAppDirectory() + public function testLocateFileNotNamespacedFindesWithoutFolderInAppDirectory(): void { $file = 'Common'; // not namespaced @@ -85,7 +85,7 @@ public function testLocateFileNotNamespacedFindesWithoutFolderInAppDirectory() $this->assertSame($expected, $this->locator->locateFile($file)); } - public function testLocateFileNotNamespacedWorksInNestedAppDirectory() + public function testLocateFileNotNamespacedWorksInNestedAppDirectory(): void { $file = 'Controllers/Home'; // not namespaced @@ -95,7 +95,7 @@ public function testLocateFileNotNamespacedWorksInNestedAppDirectory() $this->assertSame($expected, $this->locator->locateFile($file, 'Controllers')); } - public function testLocateFileWithFolderNameInFile() + public function testLocateFileWithFolderNameInFile(): void { $file = '\App\Views/errors/html/error_404.php'; @@ -105,7 +105,7 @@ public function testLocateFileWithFolderNameInFile() $this->assertSame($expected, $this->locator->locateFile($file, 'Views')); } - public function testLocateFileNotNamespacedWithFolderNameInFile() + public function testLocateFileNotNamespacedWithFolderNameInFile(): void { $file = 'Views/welcome_message.php'; // not namespaced @@ -115,7 +115,7 @@ public function testLocateFileNotNamespacedWithFolderNameInFile() $this->assertSame($expected, $this->locator->locateFile($file, 'Views')); } - public function testLocateFileCanFindNamespacedView() + public function testLocateFileCanFindNamespacedView(): void { $file = '\Errors\error_404'; @@ -125,7 +125,7 @@ public function testLocateFileCanFindNamespacedView() $this->assertSame($expected, $this->locator->locateFile($file, 'html')); } - public function testLocateFileCanFindNestedNamespacedView() + public function testLocateFileCanFindNestedNamespacedView(): void { $file = '\Errors\html/error_404'; @@ -134,7 +134,7 @@ public function testLocateFileCanFindNestedNamespacedView() $this->assertSame($expected, $this->locator->locateFile($file, 'html')); } - public function testLocateFileCanFindNamespacedViewWhenVendorHasTwoNamespaces() + public function testLocateFileCanFindNamespacedViewWhenVendorHasTwoNamespaces(): void { $file = '\CodeIgniter\Devkit\View\Views/simple'; @@ -143,21 +143,21 @@ public function testLocateFileCanFindNamespacedViewWhenVendorHasTwoNamespaces() $this->assertSame($expected, $this->locator->locateFile($file, 'Views')); } - public function testLocateFileNotFoundExistingNamespace() + public function testLocateFileNotFoundExistingNamespace(): void { $file = '\App\Views/unexistence-file.php'; $this->assertFalse($this->locator->locateFile($file, 'Views')); } - public function testLocateFileNotFoundWithBadNamespace() + public function testLocateFileNotFoundWithBadNamespace(): void { $file = '\Blogger\admin/posts.php'; $this->assertFalse($this->locator->locateFile($file, 'Views')); } - public function testLocateFileWithProperNamespace() + public function testLocateFileWithProperNamespace(): void { $file = 'Acme\SampleProject\View\Views\simple'; @@ -166,7 +166,7 @@ public function testLocateFileWithProperNamespace() $this->assertSame($expected, $this->locator->locateFile($file, 'Views')); } - public function testSearchSimple() + public function testSearchSimple(): void { $expected = APPPATH . 'Config/App.php'; @@ -175,7 +175,7 @@ public function testSearchSimple() $this->assertSame($expected, $foundFiles[0]); } - public function testSearchWithFileExtension() + public function testSearchWithFileExtension(): void { $expected = APPPATH . 'Config/App.php'; @@ -184,7 +184,7 @@ public function testSearchWithFileExtension() $this->assertSame($expected, $foundFiles[0]); } - public function testSearchWithMultipleFilesFound() + public function testSearchWithMultipleFilesFound(): void { $foundFiles = $this->locator->search('index', 'html'); @@ -195,14 +195,14 @@ public function testSearchWithMultipleFilesFound() $this->assertContains($expected, $foundFiles); } - public function testSearchForFileNotExist() + public function testSearchForFileNotExist(): void { $foundFiles = $this->locator->search('Views/Fake.html'); $this->assertArrayNotHasKey(0, $foundFiles); } - public function testSearchPrioritizeSystemOverApp() + public function testSearchPrioritizeSystemOverApp(): void { $foundFiles = $this->locator->search('Language/en/Validation.php', 'php', false); @@ -215,12 +215,12 @@ public function testSearchPrioritizeSystemOverApp() ); } - public function testListNamespaceFilesEmptyPrefixAndPath() + public function testListNamespaceFilesEmptyPrefixAndPath(): void { $this->assertEmpty($this->locator->listNamespaceFiles('', '')); } - public function testListFilesSimple() + public function testListFilesSimple(): void { $files = $this->locator->listFiles('Config/'); @@ -229,7 +229,7 @@ public function testListFilesSimple() $this->assertTrue(in_array($expectedWin, $files, true) || in_array($expectedLin, $files, true)); } - public function testListFilesDoesNotContainDirectories() + public function testListFilesDoesNotContainDirectories(): void { $files = $this->locator->listFiles('Config/'); @@ -241,14 +241,14 @@ public function testListFilesDoesNotContainDirectories() $this->assertNotContains($directory, $files); } - public function testListFilesWithFileAsInput() + public function testListFilesWithFileAsInput(): void { $files = $this->locator->listFiles('Config/App.php'); $this->assertEmpty($files); } - public function testListFilesFromMultipleDir() + public function testListFilesFromMultipleDir(): void { $files = $this->locator->listFiles('Filters/'); @@ -261,21 +261,21 @@ public function testListFilesFromMultipleDir() $this->assertTrue(in_array($expectedWin, $files, true) || in_array($expectedLin, $files, true)); } - public function testListFilesWithPathNotExist() + public function testListFilesWithPathNotExist(): void { $files = $this->locator->listFiles('Fake/'); $this->assertEmpty($files); } - public function testListFilesWithoutPath() + public function testListFilesWithoutPath(): void { $files = $this->locator->listFiles(''); $this->assertEmpty($files); } - public function testFindQNameFromPathSimple() + public function testFindQNameFromPathSimple(): void { $ClassName = $this->locator->findQualifiedNameFromPath(SYSTEMPATH . 'HTTP/Header.php'); $expected = '\\' . Header::class; @@ -283,21 +283,21 @@ public function testFindQNameFromPathSimple() $this->assertSame($expected, $ClassName); } - public function testFindQNameFromPathWithFileNotExist() + public function testFindQNameFromPathWithFileNotExist(): void { $ClassName = $this->locator->findQualifiedNameFromPath('modules/blog/Views/index.php'); $this->assertFalse($ClassName); } - public function testFindQNameFromPathWithoutCorrespondingNamespace() + public function testFindQNameFromPathWithoutCorrespondingNamespace(): void { $ClassName = $this->locator->findQualifiedNameFromPath('/etc/hosts'); $this->assertFalse($ClassName); } - public function testGetClassNameFromClassFile() + public function testGetClassNameFromClassFile(): void { $this->assertSame( self::class, @@ -305,7 +305,7 @@ public function testGetClassNameFromClassFile() ); } - public function testGetClassNameFromNonClassFile() + public function testGetClassNameFromNonClassFile(): void { $this->assertSame( '', diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 3068328aa9a8..e02db8d97515 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -26,21 +26,21 @@ final class CLITest extends CIUnitTestCase { use StreamFilterTrait; - public function testNew() + public function testNew(): void { $actual = new CLI(); $this->assertInstanceOf(CLI::class, $actual); } - public function testBeep() + public function testBeep(): void { $this->expectOutputString("\x07"); CLI::beep(); } - public function testBeep4() + public function testBeep4(): void { $this->expectOutputString("\x07\x07\x07\x07"); @@ -53,7 +53,7 @@ public function testBeep4() * * @timeLimit 2.5 */ - public function testWait() + public function testWait(): void { $time = time(); CLI::wait(1, true); @@ -64,7 +64,7 @@ public function testWait() $this->assertCloseEnough(1, time() - $time); } - public function testWaitZero() + public function testWaitZero(): void { PhpStreamWrapper::register(); PhpStreamWrapper::setContent(' '); @@ -78,7 +78,7 @@ public function testWaitZero() PhpStreamWrapper::restore(); } - public function testPrompt() + public function testPrompt(): void { PhpStreamWrapper::register(); @@ -92,7 +92,7 @@ public function testPrompt() PhpStreamWrapper::restore(); } - public function testPromptByMultipleKeys() + public function testPromptByMultipleKeys(): void { PhpStreamWrapper::register(); @@ -112,14 +112,14 @@ public function testPromptByMultipleKeys() PhpStreamWrapper::restore(); } - public function testNewLine() + public function testNewLine(): void { $this->expectOutputString(''); CLI::newLine(); } - public function testColorExceptionForeground() + public function testColorExceptionForeground(): void { $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Invalid "foreground" color: "Foreground"'); @@ -127,7 +127,7 @@ public function testColorExceptionForeground() CLI::color('test', 'Foreground'); } - public function testColorExceptionBackground() + public function testColorExceptionBackground(): void { $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Invalid "background" color: "Background"'); @@ -135,7 +135,7 @@ public function testColorExceptionBackground() CLI::color('test', 'white', 'Background'); } - public function testColorSupportOnNoColor() + public function testColorSupportOnNoColor(): void { $nocolor = getenv('NO_COLOR'); putenv('NO_COLOR=1'); @@ -146,7 +146,7 @@ public function testColorSupportOnNoColor() putenv($nocolor ? "NO_COLOR={$nocolor}" : 'NO_COLOR'); } - public function testColorSupportOnHyperTerminals() + public function testColorSupportOnHyperTerminals(): void { $termProgram = getenv('TERM_PROGRAM'); putenv('TERM_PROGRAM=Hyper'); @@ -157,13 +157,13 @@ public function testColorSupportOnHyperTerminals() putenv($termProgram ? "TERM_PROGRAM={$termProgram}" : 'TERM_PROGRAM'); } - public function testStreamSupports() + public function testStreamSupports(): void { $this->assertTrue(CLI::streamSupports('stream_isatty', STDOUT)); $this->assertIsBool(CLI::streamSupports('sapi_windows_vt100_support', STDOUT)); } - public function testColor() + public function testColor(): void { // After the tests on NO_COLOR and TERM_PROGRAM above, // the $isColored variable is rigged. So we reset this. @@ -175,7 +175,7 @@ public function testColor() ); } - public function testColorEmtpyString() + public function testColorEmtpyString(): void { $this->assertSame( '', @@ -183,7 +183,7 @@ public function testColorEmtpyString() ); } - public function testPrint() + public function testPrint(): void { CLI::print('test'); @@ -191,7 +191,7 @@ public function testPrint() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testPrintForeground() + public function testPrintForeground(): void { CLI::print('test', 'red'); @@ -199,7 +199,7 @@ public function testPrintForeground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testPrintBackground() + public function testPrintBackground(): void { CLI::print('test', 'red', 'green'); @@ -207,7 +207,7 @@ public function testPrintBackground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWrite() + public function testWrite(): void { CLI::write('test'); @@ -215,7 +215,7 @@ public function testWrite() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWriteForeground() + public function testWriteForeground(): void { CLI::write('test', 'red'); @@ -223,7 +223,7 @@ public function testWriteForeground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWriteForegroundWithColorBefore() + public function testWriteForegroundWithColorBefore(): void { CLI::write(CLI::color('green', 'green') . ' red', 'red'); @@ -231,7 +231,7 @@ public function testWriteForegroundWithColorBefore() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWriteForegroundWithColorAfter() + public function testWriteForegroundWithColorAfter(): void { CLI::write('red ' . CLI::color('green', 'green'), 'red'); @@ -242,7 +242,7 @@ public function testWriteForegroundWithColorAfter() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5892 */ - public function testWriteForegroundWithColorTwice() + public function testWriteForegroundWithColorTwice(): void { CLI::write( CLI::color('green', 'green') . ' red ' . CLI::color('green', 'green'), @@ -253,7 +253,7 @@ public function testWriteForegroundWithColorTwice() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWriteBackground() + public function testWriteBackground(): void { CLI::write('test', 'red', 'green'); @@ -261,7 +261,7 @@ public function testWriteBackground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testError() + public function testError(): void { CLI::error('test'); @@ -270,7 +270,7 @@ public function testError() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testErrorForeground() + public function testErrorForeground(): void { CLI::error('test', 'purple'); @@ -278,7 +278,7 @@ public function testErrorForeground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testErrorBackground() + public function testErrorBackground(): void { CLI::error('test', 'purple', 'green'); @@ -286,7 +286,7 @@ public function testErrorBackground() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testShowProgress() + public function testShowProgress(): void { CLI::write('first.'); CLI::showProgress(1, 20); @@ -312,7 +312,7 @@ public function testShowProgress() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testShowProgressWithoutBar() + public function testShowProgressWithoutBar(): void { CLI::write('first.'); CLI::showProgress(false, 20); @@ -323,7 +323,7 @@ public function testShowProgressWithoutBar() $this->assertSame($expected, $this->getStreamFilterBuffer()); } - public function testWrap() + public function testWrap(): void { $this->assertSame('', CLI::wrap('')); $this->assertSame( @@ -340,7 +340,7 @@ public function testWrap() ); } - public function testParseCommand() + public function testParseCommand(): void { $_SERVER['argv'] = [ 'ignored', @@ -359,7 +359,7 @@ public function testParseCommand() $this->assertSame(['b', 'c'], CLI::getSegments()); } - public function testParseCommandMixed() + public function testParseCommandMixed(): void { $_SERVER['argv'] = [ 'ignored', @@ -388,7 +388,7 @@ public function testParseCommandMixed() $this->assertSame('--parm pvalue --fix --opt-in sure', CLI::getOptionString(true, true)); } - public function testParseCommandOption() + public function testParseCommandOption(): void { $_SERVER['argv'] = [ 'ignored', @@ -410,7 +410,7 @@ public function testParseCommandOption() $this->assertSame(['b', 'c', 'd'], CLI::getSegments()); } - public function testParseCommandMultipleOptions() + public function testParseCommandMultipleOptions(): void { $_SERVER['argv'] = [ 'ignored', @@ -434,7 +434,7 @@ public function testParseCommandMultipleOptions() $this->assertSame(['b', 'c', 'd'], CLI::getSegments()); } - public function testWindow() + public function testWindow(): void { $height = new ReflectionProperty(CLI::class, 'height'); $height->setAccessible(true); @@ -456,7 +456,7 @@ public function testWindow() * @param array $thead * @param array $expected */ - public function testTable($tbody, $thead, $expected) + public function testTable($tbody, $thead, $expected): void { CLI::table($tbody, $thead); @@ -548,7 +548,7 @@ public function tableProvider(): iterable ]; } - public function testStrlen() + public function testStrlen(): void { $this->assertSame(18, mb_strlen(CLI::color('success', 'green'))); $this->assertSame(7, CLI::strlen(CLI::color('success', 'green'))); diff --git a/tests/system/CLI/ConsoleTest.php b/tests/system/CLI/ConsoleTest.php index ec1198287906..78bc5415b8ed 100644 --- a/tests/system/CLI/ConsoleTest.php +++ b/tests/system/CLI/ConsoleTest.php @@ -45,7 +45,7 @@ protected function setUp(): void $this->app->initialize(); } - public function testHeader() + public function testHeader(): void { $console = new Console(); $console->showHeader(); @@ -58,14 +58,14 @@ public function testHeader() ); } - public function testNoHeader() + public function testNoHeader(): void { $console = new Console(); $console->showHeader(true); $this->assertSame('', $this->getStreamFilterBuffer()); } - public function testRun() + public function testRun(): void { $this->initCLI(); @@ -77,7 +77,7 @@ public function testRun() $this->assertStringContainsString('Displays basic usage information.', $this->getStreamFilterBuffer()); } - public function testBadCommand() + public function testBadCommand(): void { $this->initCLI('bogus'); @@ -88,7 +88,7 @@ public function testBadCommand() $this->assertStringContainsString('Command "bogus" not found', $this->getStreamFilterBuffer()); } - public function testHelpCommandDetails() + public function testHelpCommandDetails(): void { $this->initCLI('help', 'session:migration'); @@ -101,7 +101,7 @@ public function testHelpCommandDetails() $this->assertStringContainsString('Options:', $this->getStreamFilterBuffer()); } - public function testHelpCommandUsingHelpOption() + public function testHelpCommandUsingHelpOption(): void { $this->initCLI('env', '--help'); @@ -114,7 +114,7 @@ public function testHelpCommandUsingHelpOption() ); } - public function testHelpOptionIsOnlyPassed() + public function testHelpOptionIsOnlyPassed(): void { $this->initCLI('--help'); @@ -125,7 +125,7 @@ public function testHelpOptionIsOnlyPassed() $this->assertStringContainsString('Lists the available commands.', $this->getStreamFilterBuffer()); } - public function testHelpArgumentAndHelpOptionCombined() + public function testHelpArgumentAndHelpOptionCombined(): void { $this->initCLI('help', '--help'); diff --git a/tests/system/Cache/CacheFactoryTest.php b/tests/system/Cache/CacheFactoryTest.php index 3b1288c157bd..1ca778b28faa 100644 --- a/tests/system/Cache/CacheFactoryTest.php +++ b/tests/system/Cache/CacheFactoryTest.php @@ -46,12 +46,12 @@ protected function tearDown(): void } } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(CacheFactory::class, $this->cacheFactory); } - public function testGetHandlerExceptionCacheInvalidHandlers() + public function testGetHandlerExceptionCacheInvalidHandlers(): void { $this->expectException(CacheException::class); $this->expectExceptionMessage('Cache config must have an array of $validHandlers.'); @@ -61,7 +61,7 @@ public function testGetHandlerExceptionCacheInvalidHandlers() $this->cacheFactory->getHandler($this->config); } - public function testGetHandlerExceptionCacheHandlerNotFound() + public function testGetHandlerExceptionCacheHandlerNotFound(): void { $this->expectException(CacheException::class); $this->expectExceptionMessage('Cache config has an invalid handler or backup handler specified.'); @@ -71,7 +71,7 @@ public function testGetHandlerExceptionCacheHandlerNotFound() $this->cacheFactory->getHandler($this->config); } - public function testGetDummyHandler() + public function testGetDummyHandler(): void { if (! is_dir($this->config->storePath)) { mkdir($this->config->storePath, 0555, true); @@ -86,7 +86,7 @@ public function testGetDummyHandler() $this->config->storePath .= self::$directory; } - public function testHandlesBadHandler() + public function testHandlesBadHandler(): void { if (! is_dir($this->config->storePath)) { mkdir($this->config->storePath, 0555, true); diff --git a/tests/system/Cache/CacheMockTest.php b/tests/system/Cache/CacheMockTest.php index 492bef9264b8..72a901aa36aa 100644 --- a/tests/system/Cache/CacheMockTest.php +++ b/tests/system/Cache/CacheMockTest.php @@ -22,7 +22,7 @@ */ final class CacheMockTest extends CIUnitTestCase { - public function testMockReturnsMockCacheClass() + public function testMockReturnsMockCacheClass(): void { $this->assertInstanceOf(BaseHandler::class, service('cache')); @@ -31,7 +31,7 @@ public function testMockReturnsMockCacheClass() $this->assertInstanceOf(MockCache::class, service('cache')); } - public function testMockCaching() + public function testMockCaching(): void { $mock = mock(CacheFactory::class); diff --git a/tests/system/Cache/Handlers/AbstractHandlerTest.php b/tests/system/Cache/Handlers/AbstractHandlerTest.php index e426e02eb3c5..fbb27971628e 100644 --- a/tests/system/Cache/Handlers/AbstractHandlerTest.php +++ b/tests/system/Cache/Handlers/AbstractHandlerTest.php @@ -25,12 +25,12 @@ abstract class AbstractHandlerTest extends CIUnitTestCase protected static $key3 = 'key3'; protected static $dummy = 'dymmy'; - public function testGetMetaDataMiss() + public function testGetMetaDataMiss(): void { $this->assertNull($this->handler->getMetaData(self::$dummy)); } - public function testGetMetaData() + public function testGetMetaData(): void { $time = Time::now()->getTimestamp(); $this->handler->save(self::$key1, 'value'); diff --git a/tests/system/Cache/Handlers/BaseHandlerTest.php b/tests/system/Cache/Handlers/BaseHandlerTest.php index ba1dd0b2491f..2e835760e9e4 100644 --- a/tests/system/Cache/Handlers/BaseHandlerTest.php +++ b/tests/system/Cache/Handlers/BaseHandlerTest.php @@ -27,7 +27,7 @@ final class BaseHandlerTest extends CIUnitTestCase * * @param mixed $input */ - public function testValidateKeyInvalidType($input) + public function testValidateKeyInvalidType($input): void { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Cache key must be a string'); @@ -46,7 +46,7 @@ public function invalidTypeProvider(): iterable ]; } - public function testValidateKeyUsesConfig() + public function testValidateKeyUsesConfig(): void { config('Cache')->reservedCharacters = 'b'; @@ -56,7 +56,7 @@ public function testValidateKeyUsesConfig() BaseHandler::validateKey('banana'); } - public function testValidateKeySuccess() + public function testValidateKeySuccess(): void { $string = 'banana'; $result = BaseHandler::validateKey($string); @@ -64,7 +64,7 @@ public function testValidateKeySuccess() $this->assertSame($string, $result); } - public function testValidateKeySuccessWithPrefix() + public function testValidateKeySuccessWithPrefix(): void { $string = 'banana'; $result = BaseHandler::validateKey($string, 'prefix'); @@ -72,7 +72,7 @@ public function testValidateKeySuccessWithPrefix() $this->assertSame('prefix' . $string, $result); } - public function testValidateExcessiveLength() + public function testValidateExcessiveLength(): void { $string = 'MoreThanTenCharacters'; $expected = md5($string); @@ -82,7 +82,7 @@ public function testValidateExcessiveLength() $this->assertSame($expected, $result); } - public function testValidateExcessiveLengthWithPrefix() + public function testValidateExcessiveLengthWithPrefix(): void { $string = 'MoreThanTenCharacters'; $expected = 'prefix' . md5($string); diff --git a/tests/system/Cache/Handlers/DummyHandlerTest.php b/tests/system/Cache/Handlers/DummyHandlerTest.php index 71ca66a907d0..79dfda094acf 100644 --- a/tests/system/Cache/Handlers/DummyHandlerTest.php +++ b/tests/system/Cache/Handlers/DummyHandlerTest.php @@ -28,64 +28,64 @@ protected function setUp(): void $this->handler->initialize(); } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(DummyHandler::class, $this->handler); } - public function testGet() + public function testGet(): void { $this->assertNull($this->handler->get('key')); } - public function testRemember() + public function testRemember(): void { $dummyHandler = $this->handler->remember('key', 2, static fn () => 'value'); $this->assertNull($dummyHandler); } - public function testSave() + public function testSave(): void { $this->assertTrue($this->handler->save('key', 'value')); } - public function testDelete() + public function testDelete(): void { $this->assertTrue($this->handler->delete('key')); } - public function testDeleteMatching() + public function testDeleteMatching(): void { $this->assertSame(0, $this->handler->deleteMatching('key*')); } - public function testIncrement() + public function testIncrement(): void { $this->assertTrue($this->handler->increment('key')); } - public function testDecrement() + public function testDecrement(): void { $this->assertTrue($this->handler->decrement('key')); } - public function testClean() + public function testClean(): void { $this->assertTrue($this->handler->clean()); } - public function testGetCacheInfo() + public function testGetCacheInfo(): void { $this->assertNull($this->handler->getCacheInfo()); } - public function testGetMetaData() + public function testGetMetaData(): void { $this->assertNull($this->handler->getMetaData('key')); } - public function testIsSupported() + public function testIsSupported(): void { $this->assertTrue($this->handler->isSupported()); } diff --git a/tests/system/Cache/Handlers/FileHandlerTest.php b/tests/system/Cache/Handlers/FileHandlerTest.php index 6f5e6b82f8c5..db8387b8c9cf 100644 --- a/tests/system/Cache/Handlers/FileHandlerTest.php +++ b/tests/system/Cache/Handlers/FileHandlerTest.php @@ -73,7 +73,7 @@ protected function tearDown(): void } } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(FileHandler::class, $this->handler); } @@ -83,7 +83,7 @@ public function testNew() * * @requires OS Linux|Darwin */ - public function testNewWithNonWritablePath() + public function testNewWithNonWritablePath(): void { $this->expectException(CacheException::class); @@ -91,7 +91,7 @@ public function testNewWithNonWritablePath() new FileHandler($this->config); } - public function testSetDefaultPath() + public function testSetDefaultPath(): void { // Initialize path $config = new Cache(); @@ -109,7 +109,7 @@ public function testSetDefaultPath() * * @timeLimit 3.5 */ - public function testGet() + public function testGet(): void { $this->handler->save(self::$key1, 'value', 2); @@ -126,7 +126,7 @@ public function testGet() * * @timeLimit 3.5 */ - public function testRemember() + public function testRemember(): void { $this->handler->remember(self::$key1, 2, static fn () => 'value'); @@ -142,7 +142,7 @@ public function testRemember() * * @requires OS Linux|Darwin */ - public function testSave() + public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); @@ -150,7 +150,7 @@ public function testSave() $this->assertFalse($this->handler->save(self::$key2, 'value')); } - public function testSaveExcessiveKeyLength() + public function testSaveExcessiveKeyLength(): void { $key = str_repeat('a', 260); $file = $this->config->file['storePath'] . DIRECTORY_SEPARATOR . md5($key); @@ -161,7 +161,7 @@ public function testSaveExcessiveKeyLength() unlink($file); } - public function testSavePermanent() + public function testSavePermanent(): void { $this->assertTrue($this->handler->save(self::$key1, 'value', 0)); $metaData = $this->handler->getMetaData(self::$key1); @@ -173,7 +173,7 @@ public function testSavePermanent() $this->assertTrue($this->handler->delete(self::$key1)); } - public function testDelete() + public function testDelete(): void { $this->handler->save(self::$key1, 'value'); @@ -181,7 +181,7 @@ public function testDelete() $this->assertFalse($this->handler->delete(self::$dummy)); } - public function testDeleteMatchingPrefix() + public function testDeleteMatchingPrefix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -202,7 +202,7 @@ public function testDeleteMatchingPrefix() $this->handler->clean(); } - public function testDeleteMatchingSuffix() + public function testDeleteMatchingSuffix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -223,7 +223,7 @@ public function testDeleteMatchingSuffix() $this->handler->clean(); } - public function testIncrement() + public function testIncrement(): void { $this->handler->save(self::$key1, 1); $this->handler->save(self::$key2, 'value'); @@ -233,7 +233,7 @@ public function testIncrement() $this->assertSame(10, $this->handler->increment(self::$key3, 10)); } - public function testDecrement() + public function testDecrement(): void { $this->handler->save(self::$key1, 10); $this->handler->save(self::$key2, 'value'); @@ -246,7 +246,7 @@ public function testDecrement() $this->assertSame(-1, $this->handler->decrement(self::$key3, 1)); } - public function testClean() + public function testClean(): void { $this->handler->save(self::$key1, 1); $this->handler->save(self::$key2, 'value'); @@ -257,7 +257,7 @@ public function testClean() $this->handler->save(self::$key2, 'value'); } - public function testGetCacheInfo() + public function testGetCacheInfo(): void { $this->handler->save(self::$key1, 'value'); @@ -267,7 +267,7 @@ public function testGetCacheInfo() $this->assertArrayHasKey('server_path', $actual[self::$key1]); } - public function testIsSupported() + public function testIsSupported(): void { $this->assertTrue($this->handler->isSupported()); } @@ -318,7 +318,7 @@ public function modeProvider(): iterable ]; } - public function testFileHandler() + public function testFileHandler(): void { $fileHandler = new BaseTestFileHandler(); @@ -333,7 +333,7 @@ public function testFileHandler() $this->assertArrayHasKey('fileperms', $actual); } - public function testGetMetaDataMiss() + public function testGetMetaDataMiss(): void { $this->assertFalse($this->handler->getMetaData(self::$dummy)); } diff --git a/tests/system/Cache/Handlers/MemcachedHandlerTest.php b/tests/system/Cache/Handlers/MemcachedHandlerTest.php index 24465af9e7de..986507d3e180 100644 --- a/tests/system/Cache/Handlers/MemcachedHandlerTest.php +++ b/tests/system/Cache/Handlers/MemcachedHandlerTest.php @@ -56,7 +56,7 @@ protected function tearDown(): void } } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(MemcachedHandler::class, $this->handler); } @@ -67,7 +67,7 @@ public function testNew() * * @timeLimit 3.5 */ - public function testGet() + public function testGet(): void { $this->handler->save(self::$key1, 'value', 2); @@ -84,7 +84,7 @@ public function testGet() * * @timeLimit 3.5 */ - public function testRemember() + public function testRemember(): void { $this->handler->remember(self::$key1, 2, static fn () => 'value'); @@ -95,12 +95,12 @@ public function testRemember() $this->assertNull($this->handler->get(self::$key1)); } - public function testSave() + public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); } - public function testSavePermanent() + public function testSavePermanent(): void { $this->assertTrue($this->handler->save(self::$key1, 'value', 0)); $metaData = $this->handler->getMetaData(self::$key1); @@ -112,7 +112,7 @@ public function testSavePermanent() $this->assertTrue($this->handler->delete(self::$key1)); } - public function testDelete() + public function testDelete(): void { $this->handler->save(self::$key1, 'value'); @@ -120,7 +120,7 @@ public function testDelete() $this->assertFalse($this->handler->delete(self::$dummy)); } - public function testDeleteMatching() + public function testDeleteMatching(): void { // Not implemented for Memcached, should throw an exception $this->expectException(Exception::class); @@ -128,7 +128,7 @@ public function testDeleteMatching() $this->handler->deleteMatching('key*'); } - public function testIncrement() + public function testIncrement(): void { $this->handler->save(self::$key1, 1); @@ -147,7 +147,7 @@ public function testIncrement() $this->assertSame(10, $memcachedHandler->increment(self::$key3, 10)); } - public function testDecrement() + public function testDecrement(): void { $this->handler->save(self::$key1, 10); @@ -166,7 +166,7 @@ public function testDecrement() $this->assertSame(1, $memcachedHandler->decrement(self::$key3, 1)); } - public function testClean() + public function testClean(): void { $this->handler->save(self::$key1, 1); $this->handler->save(self::$key2, 'value'); @@ -174,19 +174,19 @@ public function testClean() $this->assertTrue($this->handler->clean()); } - public function testGetCacheInfo() + public function testGetCacheInfo(): void { $this->handler->save(self::$key1, 'value'); $this->assertIsArray($this->handler->getCacheInfo()); } - public function testIsSupported() + public function testIsSupported(): void { $this->assertTrue($this->handler->isSupported()); } - public function testGetMetaDataMiss() + public function testGetMetaDataMiss(): void { $this->assertFalse($this->handler->getMetaData(self::$dummy)); } diff --git a/tests/system/Cache/Handlers/PredisHandlerTest.php b/tests/system/Cache/Handlers/PredisHandlerTest.php index 17a43e36263f..e1677ba6a1b0 100644 --- a/tests/system/Cache/Handlers/PredisHandlerTest.php +++ b/tests/system/Cache/Handlers/PredisHandlerTest.php @@ -51,12 +51,12 @@ protected function tearDown(): void } } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(PredisHandler::class, $this->handler); } - public function testDestruct() + public function testDestruct(): void { $this->handler = new PredisHandler($this->config); $this->handler->initialize(); @@ -70,7 +70,7 @@ public function testDestruct() * * @timeLimit 3.5 */ - public function testGet() + public function testGet(): void { $this->handler->save(self::$key1, 'value', 2); @@ -87,7 +87,7 @@ public function testGet() * * @timeLimit 3.5 */ - public function testRemember() + public function testRemember(): void { $this->handler->remember(self::$key1, 2, static fn () => 'value'); @@ -98,12 +98,12 @@ public function testRemember() $this->assertNull($this->handler->get(self::$key1)); } - public function testSave() + public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); } - public function testSavePermanent() + public function testSavePermanent(): void { $this->assertTrue($this->handler->save(self::$key1, 'value', 0)); $metaData = $this->handler->getMetaData(self::$key1); @@ -115,7 +115,7 @@ public function testSavePermanent() $this->assertTrue($this->handler->delete(self::$key1)); } - public function testDelete() + public function testDelete(): void { $this->handler->save(self::$key1, 'value'); @@ -123,7 +123,7 @@ public function testDelete() $this->assertFalse($this->handler->delete(self::$dummy)); } - public function testDeleteMatchingPrefix() + public function testDeleteMatchingPrefix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -141,7 +141,7 @@ public function testDeleteMatchingPrefix() $this->assertSame('88', $this->handler->getCacheInfo()['Keyspace']['db0']['keys']); } - public function testDeleteMatchingSuffix() + public function testDeleteMatchingSuffix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -159,7 +159,7 @@ public function testDeleteMatchingSuffix() $this->assertSame('90', $this->handler->getCacheInfo()['Keyspace']['db0']['keys']); } - public function testClean() + public function testClean(): void { $this->handler->save(self::$key1, 1); $this->handler->save(self::$key2, 'value'); @@ -167,14 +167,14 @@ public function testClean() $this->assertTrue($this->handler->clean()); } - public function testGetCacheInfo() + public function testGetCacheInfo(): void { $this->handler->save(self::$key1, 'value'); $this->assertIsArray($this->handler->getCacheInfo()); } - public function testIsSupported() + public function testIsSupported(): void { $this->assertTrue($this->handler->isSupported()); } diff --git a/tests/system/Cache/Handlers/RedisHandlerTest.php b/tests/system/Cache/Handlers/RedisHandlerTest.php index 83a30a0de362..45f35df3f718 100644 --- a/tests/system/Cache/Handlers/RedisHandlerTest.php +++ b/tests/system/Cache/Handlers/RedisHandlerTest.php @@ -55,12 +55,12 @@ protected function tearDown(): void } } - public function testNew() + public function testNew(): void { $this->assertInstanceOf(RedisHandler::class, $this->handler); } - public function testDestruct() + public function testDestruct(): void { $this->handler = new RedisHandler($this->config); $this->handler->initialize(); @@ -74,7 +74,7 @@ public function testDestruct() * * @timeLimit 3.5 */ - public function testGet() + public function testGet(): void { $this->handler->save(self::$key1, 'value', 2); @@ -91,7 +91,7 @@ public function testGet() * * @timeLimit 3.5 */ - public function testRemember() + public function testRemember(): void { $this->handler->remember(self::$key1, 2, static fn () => 'value'); @@ -102,12 +102,12 @@ public function testRemember() $this->assertNull($this->handler->get(self::$key1)); } - public function testSave() + public function testSave(): void { $this->assertTrue($this->handler->save(self::$key1, 'value')); } - public function testSavePermanent() + public function testSavePermanent(): void { $this->assertTrue($this->handler->save(self::$key1, 'value', 0)); $metaData = $this->handler->getMetaData(self::$key1); @@ -119,7 +119,7 @@ public function testSavePermanent() $this->assertTrue($this->handler->delete(self::$key1)); } - public function testDelete() + public function testDelete(): void { $this->handler->save(self::$key1, 'value'); @@ -127,7 +127,7 @@ public function testDelete() $this->assertFalse($this->handler->delete(self::$dummy)); } - public function testDeleteMatchingPrefix() + public function testDeleteMatchingPrefix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -147,7 +147,7 @@ public function testDeleteMatchingPrefix() $this->assertSame('keys=88', $dbInfo[0]); } - public function testDeleteMatchingSuffix() + public function testDeleteMatchingSuffix(): void { // Save 101 items to match on for ($i = 1; $i <= 101; $i++) { @@ -167,7 +167,7 @@ public function testDeleteMatchingSuffix() $this->assertSame('keys=90', $dbInfo[0]); } - public function testIncrementAndDecrement() + public function testIncrementAndDecrement(): void { $this->handler->save('counter', 100); @@ -184,14 +184,14 @@ public function testIncrementAndDecrement() $this->assertSame(140, $this->handler->get('counter')); } - public function testClean() + public function testClean(): void { $this->handler->save(self::$key1, 1); $this->assertTrue($this->handler->clean()); } - public function testGetCacheInfo() + public function testGetCacheInfo(): void { $this->handler->save(self::$key1, 'value'); @@ -208,7 +208,7 @@ public function testGetMetadataNotNull(): void $this->assertIsArray($metadata); } - public function testIsSupported() + public function testIsSupported(): void { $this->assertTrue($this->handler->isSupported()); } diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index ae88e6f2f3a1..a593fb279db3 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -59,7 +59,7 @@ protected function tearDown(): void $this->resetServices(); } - public function testRunEmptyDefaultRoute() + public function testRunEmptyDefaultRoute(): void { $_SERVER['argv'] = ['index.php']; $_SERVER['argc'] = 1; @@ -71,7 +71,7 @@ public function testRunEmptyDefaultRoute() $this->assertStringContainsString('Welcome to CodeIgniter', $output); } - public function testRunEmptyDefaultRouteReturnResponse() + public function testRunEmptyDefaultRouteReturnResponse(): void { $_SERVER['argv'] = ['index.php']; $_SERVER['argc'] = 1; @@ -81,7 +81,7 @@ public function testRunEmptyDefaultRouteReturnResponse() $this->assertStringContainsString('Welcome to CodeIgniter', $response->getBody()); } - public function testRunClosureRoute() + public function testRunClosureRoute(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -90,7 +90,7 @@ public function testRunClosureRoute() // Inject mock router. $routes = Services::routes(); - $routes->add('pages/(:segment)', static function ($segment) { + $routes->add('pages/(:segment)', static function ($segment): void { echo 'You want to see "' . esc($segment) . '" page.'; }); $router = Services::router($routes, Services::incomingrequest()); @@ -103,7 +103,7 @@ public function testRunClosureRoute() $this->assertStringContainsString('You want to see "about" page.', $output); } - public function testRun404Override() + public function testRun404Override(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -122,7 +122,7 @@ public function testRun404Override() $this->assertStringContainsString('Hello', $output); } - public function testRun404OverrideControllerReturnsResponse() + public function testRun404OverrideControllerReturnsResponse(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -141,7 +141,7 @@ public function testRun404OverrideControllerReturnsResponse() $this->assertStringContainsString('Oops', $output); } - public function testRun404OverrideReturnResponse() + public function testRun404OverrideReturnResponse(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -158,7 +158,7 @@ public function testRun404OverrideReturnResponse() $this->assertStringContainsString('Oops', $response->getBody()); } - public function testRun404OverrideByClosure() + public function testRun404OverrideByClosure(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -166,7 +166,7 @@ public function testRun404OverrideByClosure() // Inject mock router. $routes = new RouteCollection(Services::locator(), new Modules()); $routes->setAutoRoute(false); - $routes->set404Override(static function () { + $routes->set404Override(static function (): void { echo '404 Override by Closure.'; }); $router = Services::router($routes, Services::incomingrequest()); @@ -179,7 +179,7 @@ public function testRun404OverrideByClosure() $this->assertStringContainsString('404 Override by Closure.', $output); } - public function testControllersCanReturnString() + public function testControllersCanReturnString(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -199,7 +199,7 @@ public function testControllersCanReturnString() $this->assertStringContainsString('You want to see "about" page.', $output); } - public function testControllersCanReturnResponseObject() + public function testControllersCanReturnResponseObject(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -227,7 +227,7 @@ public function testControllersCanReturnResponseObject() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/6358 */ - public function testControllersCanReturnDownloadResponseObject() + public function testControllersCanReturnDownloadResponseObject(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -251,7 +251,7 @@ public function testControllersCanReturnDownloadResponseObject() $this->assertSame('some text', $output); } - public function testControllersRunFilterByClassName() + public function testControllersRunFilterByClassName(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -274,7 +274,7 @@ public function testControllersRunFilterByClassName() $this->resetServices(); } - public function testDisableControllerFilters() + public function testDisableControllerFilters(): void { $_SERVER['argv'] = ['index.php', 'pages/about']; $_SERVER['argc'] = 2; @@ -301,7 +301,7 @@ public function testDisableControllerFilters() $this->resetServices(); } - public function testResponseConfigEmpty() + public function testResponseConfigEmpty(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -311,7 +311,7 @@ public function testResponseConfigEmpty() $this->assertInstanceOf(Response::class, $response); } - public function testRoutesIsEmpty() + public function testRoutesIsEmpty(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -327,7 +327,7 @@ public function testRoutesIsEmpty() $this->assertStringContainsString('Welcome to CodeIgniter', $output); } - public function testTransfersCorrectHTTPVersion() + public function testTransfersCorrectHTTPVersion(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -343,7 +343,7 @@ public function testTransfersCorrectHTTPVersion() $this->assertSame('2.0', $response->getProtocolVersion()); } - public function testSupportsHttp3() + public function testSupportsHttp3(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -359,7 +359,7 @@ public function testSupportsHttp3() $this->assertSame('3.0', $response->getProtocolVersion()); } - public function testIgnoringErrorSuppressedByAt() + public function testIgnoringErrorSuppressedByAt(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -372,7 +372,7 @@ public function testIgnoringErrorSuppressedByAt() $this->assertStringContainsString('Welcome to CodeIgniter', $output); } - public function testRunForceSecure() + public function testRunForceSecure(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -397,7 +397,7 @@ public function testRunForceSecure() $this->assertSame('https://example.com/', $response->header('Location')->getValue()); } - public function testRunRedirectionWithNamed() + public function testRunRedirectionWithNamed(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -406,7 +406,7 @@ public function testRunRedirectionWithNamed() // Inject mock router. $routes = Services::routes(); - $routes->add('pages/named', static function () { + $routes->add('pages/named', static function (): void { }, ['as' => 'name']); $routes->addRedirect('example', 'name'); @@ -420,7 +420,7 @@ public function testRunRedirectionWithNamed() $this->assertSame('http://example.com/pages/named', $response->header('Location')->getValue()); } - public function testRunRedirectionWithURI() + public function testRunRedirectionWithURI(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -429,7 +429,7 @@ public function testRunRedirectionWithURI() // Inject mock router. $routes = Services::routes(); - $routes->add('pages/uri', static function () { + $routes->add('pages/uri', static function (): void { }); $routes->addRedirect('example', 'pages/uri'); @@ -446,7 +446,7 @@ public function testRunRedirectionWithURI() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/3041 */ - public function testRunRedirectionWithGET() + public function testRunRedirectionWithGET(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -472,7 +472,7 @@ public function testRunRedirectionWithGET() $this->assertSame(302, $response->getStatusCode()); } - public function testRunRedirectionWithGETAndHTTPCode301() + public function testRunRedirectionWithGETAndHTTPCode301(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -496,7 +496,7 @@ public function testRunRedirectionWithGETAndHTTPCode301() $this->assertSame(301, $response->getStatusCode()); } - public function testRunRedirectionWithPOSTAndHTTPCode301() + public function testRunRedirectionWithPOSTAndHTTPCode301(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -520,7 +520,7 @@ public function testRunRedirectionWithPOSTAndHTTPCode301() $this->assertSame(301, $response->getStatusCode()); } - public function testStoresPreviousURL() + public function testStoresPreviousURL(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -537,7 +537,7 @@ public function testStoresPreviousURL() $this->assertSame('http://example.com/index.php', $_SESSION['_ci_previous_url']); } - public function testNotStoresPreviousURL() + public function testNotStoresPreviousURL(): void { $_SERVER['argv'] = ['index.php', 'example']; $_SERVER['argc'] = 2; @@ -560,7 +560,7 @@ public function testNotStoresPreviousURL() $this->assertArrayNotHasKey('_ci_previous_url', $_SESSION); } - public function testNotStoresPreviousURLByCheckingContentType() + public function testNotStoresPreviousURLByCheckingContentType(): void { $_SERVER['argv'] = ['index.php', 'image']; $_SERVER['argc'] = 2; @@ -589,7 +589,7 @@ public function testNotStoresPreviousURLByCheckingContentType() * Can't use static::tearDownAfterClass. This will cause a buffer exception * need improve */ - public function testRunDefaultRoute() + public function testRunDefaultRoute(): void { $_SERVER['argv'] = ['index.php', '/']; $_SERVER['argc'] = 2; @@ -601,7 +601,7 @@ public function testRunDefaultRoute() $this->assertStringContainsString('Welcome to CodeIgniter', $output); } - public function testRunCLIRoute() + public function testRunCLIRoute(): void { $_SERVER['argv'] = ['index.php', 'cli']; $_SERVER['argc'] = 2; @@ -620,7 +620,7 @@ public function testRunCLIRoute() $this->assertStringContainsString('Method Not Allowed', $output); } - public function testSpoofRequestMethodCanUsePUT() + public function testSpoofRequestMethodCanUsePUT(): void { $_SERVER['argv'] = ['index.php']; $_SERVER['argc'] = 1; @@ -644,7 +644,7 @@ public function testSpoofRequestMethodCanUsePUT() $this->assertSame('put', Services::incomingrequest()->getMethod()); } - public function testSpoofRequestMethodCannotUseGET() + public function testSpoofRequestMethodCannotUseGET(): void { $_SERVER['argv'] = ['index.php']; $_SERVER['argc'] = 1; @@ -671,7 +671,7 @@ public function testSpoofRequestMethodCannotUseGET() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/6281 */ - public function testPageCacheSendSecureHeaders() + public function testPageCacheSendSecureHeaders(): void { // Suppress command() output CITestStreamFilter::registration(); @@ -735,7 +735,7 @@ public function testPageCacheSendSecureHeaders() * * @see https://github.com/codeigniter4/CodeIgniter4/pull/6410 */ - public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $expectedPagesInCache, array $testingUrls) + public function testPageCacheWithCacheQueryString($cacheQueryStringValue, int $expectedPagesInCache, array $testingUrls): void { // Suppress command() output CITestStreamFilter::registration(); diff --git a/tests/system/Commands/BaseCommandTest.php b/tests/system/Commands/BaseCommandTest.php index 068a8d832924..c486edb55679 100644 --- a/tests/system/Commands/BaseCommandTest.php +++ b/tests/system/Commands/BaseCommandTest.php @@ -31,28 +31,28 @@ protected function setUp(): void $this->logger = Services::logger(); } - public function testMagicIssetTrue() + public function testMagicIssetTrue(): void { $command = new AppInfo($this->logger, service('commands')); $this->assertTrue(isset($command->group)); } - public function testMagicIssetFalse() + public function testMagicIssetFalse(): void { $command = new AppInfo($this->logger, service('commands')); $this->assertFalse(isset($command->foobar)); } - public function testMagicGet() + public function testMagicGet(): void { $command = new AppInfo($this->logger, service('commands')); $this->assertSame('demo', $command->group); } - public function testMagicGetMissing() + public function testMagicGetMissing(): void { $command = new AppInfo($this->logger, service('commands')); diff --git a/tests/system/Commands/ClearCacheTest.php b/tests/system/Commands/ClearCacheTest.php index 1ada8b55f3ca..52afbfabd4d1 100644 --- a/tests/system/Commands/ClearCacheTest.php +++ b/tests/system/Commands/ClearCacheTest.php @@ -33,14 +33,14 @@ protected function setUp(): void Services::injectMock('cache', CacheFactory::getHandler(config('Cache'))); } - public function testClearCacheInvalidHandler() + public function testClearCacheInvalidHandler(): void { command('cache:clear junk'); $this->assertStringContainsString('junk is not a valid cache handler.', $this->getStreamFilterBuffer()); } - public function testClearCacheWorks() + public function testClearCacheWorks(): void { cache()->save('foo', 'bar'); $this->assertSame('bar', cache('foo')); diff --git a/tests/system/Commands/ClearDebugbarTest.php b/tests/system/Commands/ClearDebugbarTest.php index 4a398e4f4016..b8f6fa13e535 100644 --- a/tests/system/Commands/ClearDebugbarTest.php +++ b/tests/system/Commands/ClearDebugbarTest.php @@ -32,7 +32,7 @@ protected function setUp(): void $this->time = time(); } - protected function createDummyDebugbarJson() + protected function createDummyDebugbarJson(): void { $time = $this->time; $path = WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$time}.json"; @@ -46,7 +46,7 @@ protected function createDummyDebugbarJson() } } - public function testClearDebugbarWorks() + public function testClearDebugbarWorks(): void { // test clean debugbar dir $this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json"); diff --git a/tests/system/Commands/ClearLogsTest.php b/tests/system/Commands/ClearLogsTest.php index daeb0461acec..406393020343 100644 --- a/tests/system/Commands/ClearLogsTest.php +++ b/tests/system/Commands/ClearLogsTest.php @@ -34,7 +34,7 @@ protected function setUp(): void $this->date = date('Y-m-d', strtotime('+1 year')); } - protected function createDummyLogFiles() + protected function createDummyLogFiles(): void { $date = $this->date; $path = WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$date}.log"; @@ -49,7 +49,7 @@ protected function createDummyLogFiles() } } - public function testClearLogsWorks() + public function testClearLogsWorks(): void { // test clean logs dir $this->assertFileDoesNotExist(WRITEPATH . 'logs' . DIRECTORY_SEPARATOR . "log-{$this->date}.log"); diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index d72ba1b36aab..64ab5a21d2d9 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -46,7 +46,7 @@ protected function getFileContents(string $filepath): string return file_get_contents($filepath) ?: ''; } - public function testGenerateCommand() + public function testGenerateCommand(): void { command('make:command deliver'); $file = APPPATH . 'Commands/Deliver.php'; @@ -56,7 +56,7 @@ public function testGenerateCommand() $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } - public function testGenerateCommandWithOptionCommand() + public function testGenerateCommandWithOptionCommand(): void { command('make:command deliver -command clear:sessions'); $file = APPPATH . 'Commands/Deliver.php'; @@ -66,7 +66,7 @@ public function testGenerateCommandWithOptionCommand() $this->assertStringContainsString('protected $usage = \'clear:sessions [arguments] [options]\';', $contents); } - public function testGenerateCommandWithOptionTypeBasic() + public function testGenerateCommandWithOptionTypeBasic(): void { command('make:command deliver -type basic'); $file = APPPATH . 'Commands/Deliver.php'; @@ -76,7 +76,7 @@ public function testGenerateCommandWithOptionTypeBasic() $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } - public function testGenerateCommandWithOptionTypeGenerator() + public function testGenerateCommandWithOptionTypeGenerator(): void { command('make:command deliver -type generator'); $file = APPPATH . 'Commands/Deliver.php'; @@ -86,7 +86,7 @@ public function testGenerateCommandWithOptionTypeGenerator() $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } - public function testGenerateCommandWithOptionGroup() + public function testGenerateCommandWithOptionGroup(): void { command('make:command deliver -group Deliverables'); $file = APPPATH . 'Commands/Deliver.php'; @@ -97,7 +97,7 @@ public function testGenerateCommandWithOptionGroup() $this->assertStringContainsString('protected $group = \'Deliverables\';', $contents); } - public function testGenerateCommandWithOptionSuffix() + public function testGenerateCommandWithOptionSuffix(): void { command('make:command publish -suffix'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); diff --git a/tests/system/Commands/CommandTest.php b/tests/system/Commands/CommandTest.php index 1101e08ef5b6..90da337c11a0 100644 --- a/tests/system/Commands/CommandTest.php +++ b/tests/system/Commands/CommandTest.php @@ -45,7 +45,7 @@ protected function getBuffer() return $this->getStreamFilterBuffer(); } - public function testListCommands() + public function testListCommands(): void { command('list'); @@ -54,7 +54,7 @@ public function testListCommands() $this->assertStringContainsString('Displays basic usage information.', $this->getBuffer()); } - public function testListCommandsSimple() + public function testListCommandsSimple(): void { command('list --simple'); @@ -62,13 +62,13 @@ public function testListCommandsSimple() $this->assertStringNotContainsString('Lists the available commands.', $this->getBuffer()); } - public function testCustomCommand() + public function testCustomCommand(): void { command('app:info'); $this->assertStringContainsString('CI Version:', $this->getBuffer()); } - public function testShowError() + public function testShowError(): void { command('app:info'); $commands = $this->commands->getCommands(); @@ -78,7 +78,7 @@ public function testShowError() $this->assertStringContainsString('Displays basic usage information.', $this->getBuffer()); } - public function testCommandCall() + public function testCommandCall(): void { command('app:info'); $commands = $this->commands->getCommands(); @@ -88,13 +88,13 @@ public function testCommandCall() $this->assertStringContainsString('Invalid "background" color:', $this->getBuffer()); } - public function testAbstractCommand() + public function testAbstractCommand(): void { command('app:pablo'); $this->assertStringContainsString('not found', $this->getBuffer()); } - public function testNamespacesCommand() + public function testNamespacesCommand(): void { command('namespaces'); @@ -103,13 +103,13 @@ public function testNamespacesCommand() $this->assertStringContainsString('| Yes', $this->getBuffer()); } - public function testInexistentCommandWithNoAlternatives() + public function testInexistentCommandWithNoAlternatives(): void { command('app:oops'); $this->assertStringContainsString('Command "app:oops" not found', $this->getBuffer()); } - public function testInexistentCommandsButWithOneAlternative() + public function testInexistentCommandsButWithOneAlternative(): void { command('namespace'); @@ -118,7 +118,7 @@ public function testInexistentCommandsButWithOneAlternative() $this->assertStringContainsString('namespaces', $this->getBuffer()); } - public function testInexistentCommandsButWithManyAlternatives() + public function testInexistentCommandsButWithManyAlternatives(): void { command('clear'); @@ -130,7 +130,7 @@ public function testInexistentCommandsButWithManyAlternatives() /** * @dataProvider commandArgsProvider */ - public function testCommandParsesArgsCorrectly(string $input, array $expected) + public function testCommandParsesArgsCorrectly(string $input, array $expected): void { ParamsReveal::$args = null; command($input); diff --git a/tests/system/Commands/ConfigGeneratorTest.php b/tests/system/Commands/ConfigGeneratorTest.php index 08ad58a25d9c..f4036a24e65e 100644 --- a/tests/system/Commands/ConfigGeneratorTest.php +++ b/tests/system/Commands/ConfigGeneratorTest.php @@ -32,13 +32,13 @@ protected function tearDown(): void } } - public function testGenerateConfig() + public function testGenerateConfig(): void { command('make:config auth'); $this->assertFileExists(APPPATH . 'Config/Auth.php'); } - public function testGenerateConfigWithOptionSuffix() + public function testGenerateConfigWithOptionSuffix(): void { command('make:config auth -suffix'); $this->assertFileExists(APPPATH . 'Config/AuthConfig.php'); diff --git a/tests/system/Commands/ConfigurableSortImportsTest.php b/tests/system/Commands/ConfigurableSortImportsTest.php index 6e98a73cd62c..0bc5b9498c17 100644 --- a/tests/system/Commands/ConfigurableSortImportsTest.php +++ b/tests/system/Commands/ConfigurableSortImportsTest.php @@ -23,7 +23,7 @@ final class ConfigurableSortImportsTest extends CIUnitTestCase { use StreamFilterTrait; - public function testPublishLanguageWithoutOptions() + public function testPublishLanguageWithoutOptions(): void { command('publish:language'); @@ -36,7 +36,7 @@ public function testPublishLanguageWithoutOptions() } } - public function testEnabledSortImportsWillDisruptLanguageFilePublish() + public function testEnabledSortImportsWillDisruptLanguageFilePublish(): void { command('publish:language --lang es'); @@ -53,7 +53,7 @@ public function testEnabledSortImportsWillDisruptLanguageFilePublish() } } - public function testDisabledSortImportsWillNotAffectLanguageFilesPublish() + public function testDisabledSortImportsWillNotAffectLanguageFilesPublish(): void { command('publish:language --lang ar --sort off'); diff --git a/tests/system/Commands/ControllerGeneratorTest.php b/tests/system/Commands/ControllerGeneratorTest.php index 9ff4d027b45c..9567280f1d34 100644 --- a/tests/system/Commands/ControllerGeneratorTest.php +++ b/tests/system/Commands/ControllerGeneratorTest.php @@ -41,7 +41,7 @@ protected function getFileContents(string $filepath): string return file_get_contents($filepath) ?: ''; } - public function testGenerateController() + public function testGenerateController(): void { command('make:controller user'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -50,7 +50,7 @@ public function testGenerateController() $this->assertStringContainsString('extends BaseController', $this->getFileContents($file)); } - public function testGenerateControllerWithOptionBare() + public function testGenerateControllerWithOptionBare(): void { command('make:controller blog -bare'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -59,7 +59,7 @@ public function testGenerateControllerWithOptionBare() $this->assertStringContainsString('extends Controller', $this->getFileContents($file)); } - public function testGenerateControllerWithOptionRestful() + public function testGenerateControllerWithOptionRestful(): void { command('make:controller order -restful'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -68,7 +68,7 @@ public function testGenerateControllerWithOptionRestful() $this->assertStringContainsString('extends ResourceController', $this->getFileContents($file)); } - public function testGenerateControllerWithOptionRestfulPresenter() + public function testGenerateControllerWithOptionRestfulPresenter(): void { command('make:controller pay -restful presenter'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -77,7 +77,7 @@ public function testGenerateControllerWithOptionRestfulPresenter() $this->assertStringContainsString('extends ResourcePresenter', $this->getFileContents($file)); } - public function testGenerateControllerWithOptionSuffix() + public function testGenerateControllerWithOptionSuffix(): void { command('make:controller dashboard -suffix'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); diff --git a/tests/system/Commands/CreateDatabaseTest.php b/tests/system/Commands/CreateDatabaseTest.php index 7ee07a2d936d..a1468f1184dc 100644 --- a/tests/system/Commands/CreateDatabaseTest.php +++ b/tests/system/Commands/CreateDatabaseTest.php @@ -67,7 +67,7 @@ protected function getBuffer() return $this->getStreamFilterBuffer(); } - public function testCreateDatabase() + public function testCreateDatabase(): void { if ($this->connection instanceof OCI8Connection) { $this->markTestSkipped('Needs to run on non-OCI8 drivers.'); @@ -77,7 +77,7 @@ public function testCreateDatabase() $this->assertStringContainsString('successfully created.', $this->getBuffer()); } - public function testSqliteDatabaseDuplicated() + public function testSqliteDatabaseDuplicated(): void { if (! $this->connection instanceof SQLite3Connection) { $this->markTestSkipped('Needs to run on SQLite3.'); @@ -90,7 +90,7 @@ public function testSqliteDatabaseDuplicated() $this->assertStringContainsString('already exists.', $this->getBuffer()); } - public function testOtherDriverDuplicatedDatabase() + public function testOtherDriverDuplicatedDatabase(): void { if ($this->connection instanceof SQLite3Connection || $this->connection instanceof OCI8Connection) { $this->markTestSkipped('Needs to run on non-SQLite3 and non-OCI8 drivers.'); diff --git a/tests/system/Commands/DatabaseCommandsTest.php b/tests/system/Commands/DatabaseCommandsTest.php index 9d025d38517b..f0832f429efd 100644 --- a/tests/system/Commands/DatabaseCommandsTest.php +++ b/tests/system/Commands/DatabaseCommandsTest.php @@ -40,7 +40,7 @@ protected function clearBuffer(): void $this->resetStreamFilterBuffer(); } - public function testMigrate() + public function testMigrate(): void { command('migrate --all'); $this->assertStringContainsString('Migrations complete.', $this->getBuffer()); @@ -51,7 +51,7 @@ public function testMigrate() $this->assertStringContainsString('Migrations complete.', $this->getBuffer()); } - public function testMigrateRollback() + public function testMigrateRollback(): void { command('migrate --all -g tests'); $this->clearBuffer(); @@ -60,7 +60,7 @@ public function testMigrateRollback() $this->assertStringContainsString('Done rolling back migrations.', $this->getBuffer()); } - public function testMigrateRefresh() + public function testMigrateRefresh(): void { command('migrate --all'); $this->clearBuffer(); @@ -69,7 +69,7 @@ public function testMigrateRefresh() $this->assertStringContainsString('Migrations complete.', $this->getBuffer()); } - public function testMigrateStatus() + public function testMigrateStatus(): void { command('migrate --all'); $this->clearBuffer(); @@ -80,7 +80,7 @@ public function testMigrateStatus() $this->assertStringContainsString('Filename', $this->getBuffer()); } - public function testSeed() + public function testSeed(): void { command('migrate --all'); $this->clearBuffer(); diff --git a/tests/system/Commands/EntityGeneratorTest.php b/tests/system/Commands/EntityGeneratorTest.php index 5d14ddfeaf06..47146b027056 100644 --- a/tests/system/Commands/EntityGeneratorTest.php +++ b/tests/system/Commands/EntityGeneratorTest.php @@ -36,13 +36,13 @@ protected function tearDown(): void } } - public function testGenerateEntity() + public function testGenerateEntity(): void { command('make:entity user'); $this->assertFileExists(APPPATH . 'Entities/User.php'); } - public function testGenerateEntityWithOptionSuffix() + public function testGenerateEntityWithOptionSuffix(): void { command('make:entity user -suffix'); $this->assertFileExists(APPPATH . 'Entities/UserEntity.php'); diff --git a/tests/system/Commands/EnvironmentCommandTest.php b/tests/system/Commands/EnvironmentCommandTest.php index 84c796ecb669..4b7a4a473dfa 100644 --- a/tests/system/Commands/EnvironmentCommandTest.php +++ b/tests/system/Commands/EnvironmentCommandTest.php @@ -72,7 +72,7 @@ public function testProvidingUnknownEnvGivesErrorMessage(): void $this->assertStringContainsString('Invalid environment type "foobar".', $this->getStreamFilterBuffer()); } - public function testDefaultShippedEnvIsMissing() + public function testDefaultShippedEnvIsMissing(): void { rename(ROOTPATH . 'env', ROOTPATH . 'lostenv'); command('env development'); diff --git a/tests/system/Commands/FilterCheckTest.php b/tests/system/Commands/FilterCheckTest.php index 4959afb0826c..a0b74099f818 100644 --- a/tests/system/Commands/FilterCheckTest.php +++ b/tests/system/Commands/FilterCheckTest.php @@ -40,7 +40,7 @@ protected function getBuffer() return $this->getStreamFilterBuffer(); } - public function testFilterCheckDefinedRoute() + public function testFilterCheckDefinedRoute(): void { command('filter:check get /'); @@ -50,7 +50,7 @@ public function testFilterCheckDefinedRoute() ); } - public function testFilterCheckInvalidRoute() + public function testFilterCheckInvalidRoute(): void { command('filter:check put product/123'); diff --git a/tests/system/Commands/FilterGeneratorTest.php b/tests/system/Commands/FilterGeneratorTest.php index 148c7031ce3e..7f697e21c9dc 100644 --- a/tests/system/Commands/FilterGeneratorTest.php +++ b/tests/system/Commands/FilterGeneratorTest.php @@ -32,13 +32,13 @@ protected function tearDown(): void } } - public function testGenerateFilter() + public function testGenerateFilter(): void { command('make:filter admin'); $this->assertFileExists(APPPATH . 'Filters/Admin.php'); } - public function testGenerateFilterWithOptionSuffix() + public function testGenerateFilterWithOptionSuffix(): void { command('make:filter admin -suffix'); $this->assertFileExists(APPPATH . 'Filters/AdminFilter.php'); diff --git a/tests/system/Commands/GenerateKeyTest.php b/tests/system/Commands/GenerateKeyTest.php index 6c313e648cff..dd0f8bc91f0a 100644 --- a/tests/system/Commands/GenerateKeyTest.php +++ b/tests/system/Commands/GenerateKeyTest.php @@ -62,13 +62,13 @@ protected function getBuffer(): string return $this->getStreamFilterBuffer(); } - protected function resetEnvironment() + protected function resetEnvironment(): void { putenv('encryption.key'); unset($_ENV['encryption.key'], $_SERVER['encryption.key']); } - public function testGenerateKeyShowsEncodedKey() + public function testGenerateKeyShowsEncodedKey(): void { command('key:generate --show'); $this->assertStringContainsString('hex2bin:', $this->getBuffer()); @@ -84,7 +84,7 @@ public function testGenerateKeyShowsEncodedKey() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testGenerateKeyCreatesNewKey() + public function testGenerateKeyCreatesNewKey(): void { command('key:generate'); $this->assertStringContainsString('successfully set.', $this->getBuffer()); @@ -102,7 +102,7 @@ public function testGenerateKeyCreatesNewKey() $this->assertStringContainsString('hex2bin:', file_get_contents($this->envPath)); } - public function testDefaultShippedEnvIsMissing() + public function testDefaultShippedEnvIsMissing(): void { rename(ROOTPATH . 'env', ROOTPATH . 'lostenv'); command('key:generate'); @@ -115,7 +115,7 @@ public function testDefaultShippedEnvIsMissing() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/6838 */ - public function testKeyGenerateWhenKeyIsMissingInDotEnvFile() + public function testKeyGenerateWhenKeyIsMissingInDotEnvFile(): void { file_put_contents($this->envPath, ''); @@ -125,7 +125,7 @@ public function testKeyGenerateWhenKeyIsMissingInDotEnvFile() $this->assertSame("\nencryption.key = " . env('encryption.key'), file_get_contents($this->envPath)); } - public function testKeyGenerateWhenNewHexKeyIsSubsequentlyCommentedOut() + public function testKeyGenerateWhenNewHexKeyIsSubsequentlyCommentedOut(): void { command('key:generate'); $key = env('encryption.key', ''); @@ -143,7 +143,7 @@ public function testKeyGenerateWhenNewHexKeyIsSubsequentlyCommentedOut() $this->assertNotSame($key, env('encryption.key', $key), 'Failed replacing the commented out key.'); } - public function testKeyGenerateWhenNewBase64KeyIsSubsequentlyCommentedOut() + public function testKeyGenerateWhenNewBase64KeyIsSubsequentlyCommentedOut(): void { command('key:generate --prefix base64'); $key = env('encryption.key', ''); diff --git a/tests/system/Commands/GeneratorsTest.php b/tests/system/Commands/GeneratorsTest.php index d02fd2eea78b..2e5162b074a8 100644 --- a/tests/system/Commands/GeneratorsTest.php +++ b/tests/system/Commands/GeneratorsTest.php @@ -23,7 +23,7 @@ final class GeneratorsTest extends CIUnitTestCase { use StreamFilterTrait; - public function testGenerateFileCreated() + public function testGenerateFileCreated(): void { command('make:seeder categories'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -33,7 +33,7 @@ public function testGenerateFileCreated() } } - public function testGenerateFileExists() + public function testGenerateFileExists(): void { command('make:filter items'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -46,7 +46,7 @@ public function testGenerateFileExists() } } - public function testGenerateFileOverwritten() + public function testGenerateFileOverwritten(): void { command('make:controller products'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -59,7 +59,7 @@ public function testGenerateFileOverwritten() } } - public function testGenerateFileFailsOnUnwritableDirectory() + public function testGenerateFileFailsOnUnwritableDirectory(): void { if (is_windows()) { $this->markTestSkipped('chmod does not work as expected on Windows'); @@ -73,13 +73,13 @@ public function testGenerateFileFailsOnUnwritableDirectory() chmod(APPPATH . 'Filters', 0755); } - public function testGenerateFailsOnUndefinedNamespace() + public function testGenerateFailsOnUndefinedNamespace(): void { command('make:model cars -namespace CodeIgnite'); $this->assertStringContainsString('Namespace "CodeIgnite" is not defined.', $this->getStreamFilterBuffer()); } - public function testGenerateFileInSubfolders() + public function testGenerateFileInSubfolders(): void { command('make:controller admin/user'); $file = APPPATH . 'Controllers/Admin/User.php'; diff --git a/tests/system/Commands/HelpCommandTest.php b/tests/system/Commands/HelpCommandTest.php index 3b56b3c92130..c51a286e5bbf 100644 --- a/tests/system/Commands/HelpCommandTest.php +++ b/tests/system/Commands/HelpCommandTest.php @@ -28,7 +28,7 @@ protected function getBuffer() return $this->getStreamFilterBuffer(); } - public function testHelpCommand() + public function testHelpCommand(): void { command('help'); @@ -37,25 +37,25 @@ public function testHelpCommand() $this->assertStringContainsString('command_name', $this->getBuffer()); } - public function testHelpCommandWithMissingUsage() + public function testHelpCommandWithMissingUsage(): void { command('help app:info'); $this->assertStringContainsString('app:info [arguments]', $this->getBuffer()); } - public function testHelpCommandOnSpecificCommand() + public function testHelpCommandOnSpecificCommand(): void { command('help cache:clear'); $this->assertStringContainsString('Clears the current system caches.', $this->getBuffer()); } - public function testHelpCommandOnInexistentCommand() + public function testHelpCommandOnInexistentCommand(): void { command('help fixme'); $this->assertStringContainsString('Command "fixme" not found', $this->getBuffer()); } - public function testHelpCommandOnInexistentCommandButWithAlternatives() + public function testHelpCommandOnInexistentCommandButWithAlternatives(): void { command('help clear'); $this->assertStringContainsString('Command "clear" not found.', $this->getBuffer()); diff --git a/tests/system/Commands/InfoCacheTest.php b/tests/system/Commands/InfoCacheTest.php index 91312a6e36cd..fc0337087b3a 100644 --- a/tests/system/Commands/InfoCacheTest.php +++ b/tests/system/Commands/InfoCacheTest.php @@ -44,7 +44,7 @@ protected function getBuffer() return $this->getStreamFilterBuffer(); } - public function testInfoCacheErrorsOnInvalidHandler() + public function testInfoCacheErrorsOnInvalidHandler(): void { config('Cache')->handler = 'redis'; cache()->save('foo', 'bar'); @@ -53,7 +53,7 @@ public function testInfoCacheErrorsOnInvalidHandler() $this->assertStringContainsString('This command only supports the file cache handler.', $this->getBuffer()); } - public function testInfoCacheCanSeeFoo() + public function testInfoCacheCanSeeFoo(): void { cache()->save('foo', 'bar'); command('cache:info'); @@ -61,7 +61,7 @@ public function testInfoCacheCanSeeFoo() $this->assertStringContainsString('foo', $this->getBuffer()); } - public function testInfoCacheCanSeeTable() + public function testInfoCacheCanSeeTable(): void { command('cache:info'); @@ -71,7 +71,7 @@ public function testInfoCacheCanSeeTable() $this->assertStringContainsString('Date', $this->getBuffer()); } - public function testInfoCacheCannotSeeFoo() + public function testInfoCacheCannotSeeFoo(): void { cache()->delete('foo'); command('cache:info'); diff --git a/tests/system/Commands/MigrationGeneratorTest.php b/tests/system/Commands/MigrationGeneratorTest.php index b07c69726791..890c36c56fe7 100644 --- a/tests/system/Commands/MigrationGeneratorTest.php +++ b/tests/system/Commands/MigrationGeneratorTest.php @@ -32,25 +32,25 @@ protected function tearDown(): void } } - public function testGenerateMigration() + public function testGenerateMigration(): void { command('make:migration database'); $this->assertStringContainsString('_Database.php', $this->getStreamFilterBuffer()); } - public function testGenerateMigrationWithOptionSession() + public function testGenerateMigrationWithOptionSession(): void { command('make:migration -session'); $this->assertStringContainsString('_CreateCiSessionsTable.php', $this->getStreamFilterBuffer()); } - public function testGenerateMigrationWithOptionTable() + public function testGenerateMigrationWithOptionTable(): void { command('make:migration -session -table logger'); $this->assertStringContainsString('_CreateLoggerTable.php', $this->getStreamFilterBuffer()); } - public function testGenerateMigrationWithOptionSuffix() + public function testGenerateMigrationWithOptionSuffix(): void { command('make:migration database -suffix'); $this->assertStringContainsString('_DatabaseMigration.php', $this->getStreamFilterBuffer()); diff --git a/tests/system/Commands/ModelGeneratorTest.php b/tests/system/Commands/ModelGeneratorTest.php index 0e193d62702c..e6ca050d553b 100644 --- a/tests/system/Commands/ModelGeneratorTest.php +++ b/tests/system/Commands/ModelGeneratorTest.php @@ -44,7 +44,7 @@ private function getFileContent(string $filepath): string return file_get_contents($filepath) ?: ''; } - public function testGenerateModel() + public function testGenerateModel(): void { command('make:model user --table users'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -56,7 +56,7 @@ public function testGenerateModel() $this->assertStringContainsString('protected $returnType = \'array\';', $this->getFileContent($file)); } - public function testGenerateModelWithOptionTable() + public function testGenerateModelWithOptionTable(): void { command('make:model cars -table utilisateur'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -65,7 +65,7 @@ public function testGenerateModelWithOptionTable() $this->assertStringContainsString('protected $table = \'utilisateur\';', $this->getFileContent($file)); } - public function testGenerateModelWithOptionDBGroup() + public function testGenerateModelWithOptionDBGroup(): void { command('make:model user -dbgroup testing'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -74,7 +74,7 @@ public function testGenerateModelWithOptionDBGroup() $this->assertStringContainsString('protected $DBGroup = \'testing\';', $this->getFileContent($file)); } - public function testGenerateModelWithOptionReturnArray() + public function testGenerateModelWithOptionReturnArray(): void { command('make:model user --return array'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -83,7 +83,7 @@ public function testGenerateModelWithOptionReturnArray() $this->assertStringContainsString('protected $returnType = \'array\';', $this->getFileContent($file)); } - public function testGenerateModelWithOptionReturnObject() + public function testGenerateModelWithOptionReturnObject(): void { command('make:model user --return object'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -92,7 +92,7 @@ public function testGenerateModelWithOptionReturnObject() $this->assertStringContainsString('protected $returnType = \'object\';', $this->getFileContent($file)); } - public function testGenerateModelWithOptionReturnEntity() + public function testGenerateModelWithOptionReturnEntity(): void { command('make:model user --return entity'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -118,7 +118,7 @@ public function testGenerateModelWithOptionReturnEntity() } } - public function testGenerateModelWithOptionSuffix() + public function testGenerateModelWithOptionSuffix(): void { command('make:model user --suffix --return entity'); @@ -136,7 +136,7 @@ public function testGenerateModelWithOptionSuffix() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5050 */ - public function testGenerateModelWithSuffixAndMixedPascalCasedName() + public function testGenerateModelWithSuffixAndMixedPascalCasedName(): void { command('make:model MyTable --suffix --return entity'); diff --git a/tests/system/Commands/PublishCommandTest.php b/tests/system/Commands/PublishCommandTest.php index a56e7661505a..b176a03c42c5 100644 --- a/tests/system/Commands/PublishCommandTest.php +++ b/tests/system/Commands/PublishCommandTest.php @@ -31,7 +31,7 @@ protected function tearDown(): void TestPublisher::setResult(true); } - public function testDefault() + public function testDefault(): void { command('publish'); @@ -42,7 +42,7 @@ public function testDefault() ]), $this->getStreamFilterBuffer()); } - public function testFailure() + public function testFailure(): void { TestPublisher::setResult(false); diff --git a/tests/system/Commands/RoutesTest.php b/tests/system/Commands/RoutesTest.php index bb89d35bb96d..d1625dcfc1bc 100644 --- a/tests/system/Commands/RoutesTest.php +++ b/tests/system/Commands/RoutesTest.php @@ -51,7 +51,7 @@ private function getCleanRoutes(): RouteCollection return $routes; } - public function testRoutesCommand() + public function testRoutesCommand(): void { $this->getCleanRoutes(); @@ -77,7 +77,7 @@ public function testRoutesCommand() $this->assertStringContainsString($expected, $this->getBuffer()); } - public function testRoutesCommandSortByHandler() + public function testRoutesCommandSortByHandler(): void { $this->getCleanRoutes(); @@ -103,7 +103,7 @@ public function testRoutesCommandSortByHandler() $this->assertStringContainsString($expected, $this->getBuffer()); } - public function testRoutesCommandAutoRouteImproved() + public function testRoutesCommandAutoRouteImproved(): void { $routes = $this->getCleanRoutes(); @@ -136,7 +136,7 @@ public function testRoutesCommandAutoRouteImproved() $this->assertStringContainsString($expected, $this->getBuffer()); } - public function testRoutesCommandRouteLegacy() + public function testRoutesCommandRouteLegacy(): void { $routes = $this->getCleanRoutes(); diff --git a/tests/system/Commands/ScaffoldGeneratorTest.php b/tests/system/Commands/ScaffoldGeneratorTest.php index 113710725143..4caa26fd123f 100644 --- a/tests/system/Commands/ScaffoldGeneratorTest.php +++ b/tests/system/Commands/ScaffoldGeneratorTest.php @@ -43,7 +43,7 @@ protected function getFileContents(string $filepath): string return file_get_contents($filepath) ?: ''; } - public function testCreateComponentProducesManyFiles() + public function testCreateComponentProducesManyFiles(): void { command('make:scaffold people'); @@ -66,7 +66,7 @@ public function testCreateComponentProducesManyFiles() unlink(APPPATH . 'Database/Seeds/People.php'); } - public function testCreateComponentWithManyOptions() + public function testCreateComponentWithManyOptions(): void { command('make:scaffold user -restful -return entity'); @@ -95,7 +95,7 @@ public function testCreateComponentWithManyOptions() unlink(APPPATH . 'Models/User.php'); } - public function testCreateComponentWithOptionSuffix() + public function testCreateComponentWithOptionSuffix(): void { command('make:scaffold order -suffix'); @@ -118,7 +118,7 @@ public function testCreateComponentWithOptionSuffix() unlink(APPPATH . 'Models/OrderModel.php'); } - public function testCreateComponentWithOptionForce() + public function testCreateComponentWithOptionForce(): void { command('make:controller fixer'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); @@ -151,7 +151,7 @@ public function testCreateComponentWithOptionForce() unlink(APPPATH . 'Models/Fixer.php'); } - public function testCreateComponentWithOptionNamespace() + public function testCreateComponentWithOptionNamespace(): void { command('make:scaffold product -namespace App'); diff --git a/tests/system/Commands/SeederGeneratorTest.php b/tests/system/Commands/SeederGeneratorTest.php index 57586084f402..035168759f52 100644 --- a/tests/system/Commands/SeederGeneratorTest.php +++ b/tests/system/Commands/SeederGeneratorTest.php @@ -34,14 +34,14 @@ protected function tearDown(): void } } - public function testGenerateSeeder() + public function testGenerateSeeder(): void { command('make:seeder cars'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); $this->assertFileExists(APPPATH . 'Database/Seeds/Cars.php'); } - public function testGenerateSeederWithOptionSuffix() + public function testGenerateSeederWithOptionSuffix(): void { command('make:seeder cars -suffix'); $this->assertStringContainsString('File created: ', $this->getStreamFilterBuffer()); diff --git a/tests/system/Commands/Utilities/NamespacesTest.php b/tests/system/Commands/Utilities/NamespacesTest.php index 26eabd32895f..755dd70f7cc6 100644 --- a/tests/system/Commands/Utilities/NamespacesTest.php +++ b/tests/system/Commands/Utilities/NamespacesTest.php @@ -47,7 +47,7 @@ protected function getBuffer() }, str_replace(PHP_EOL, "\n", $this->getStreamFilterBuffer())); } - public function testNamespacesCommandCodeIgniterOnly() + public function testNamespacesCommandCodeIgniterOnly(): void { command('namespaces -c'); @@ -65,7 +65,7 @@ public function testNamespacesCommandCodeIgniterOnly() $this->assertStringContainsString($expected, $this->getBuffer()); } - public function testNamespacesCommandAllNamespaces() + public function testNamespacesCommandAllNamespaces(): void { command('namespaces'); diff --git a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php index 9279bd47b70c..2db5a603fb95 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouteCollectorTest.php @@ -20,7 +20,7 @@ */ final class AutoRouteCollectorTest extends CIUnitTestCase { - public function testGet() + public function testGet(): void { $namespace = 'Tests\Support\Controllers'; $collector = new AutoRouteCollector( diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php index 4b99de7dbb07..d9dfee3e98ad 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollectorTest.php @@ -52,7 +52,7 @@ private function createAutoRouteCollector(array $filterConfigFilters): AutoRoute ); } - public function testGetFilterMatches() + public function testGetFilterMatches(): void { $filterConfigFilters = ['honeypot' => ['before' => ['newautorouting/save*']]]; $collector = $this->createAutoRouteCollector($filterConfigFilters); @@ -80,7 +80,7 @@ public function testGetFilterMatches() $this->assertSame($expected, $routes); } - public function testGetFilterDoesNotMatch() + public function testGetFilterDoesNotMatch(): void { $filterConfigFilters = ['honeypot' => ['before' => ['newautorouting/save/*/*']]]; $collector = $this->createAutoRouteCollector($filterConfigFilters); diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php index 5df8c4f8ff0d..e3e23c29dc7a 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReaderTest.php @@ -34,7 +34,7 @@ private function createControllerMethodReader( return new ControllerMethodReader($namespace, $methods); } - public function testRead() + public function testRead(): void { $reader = $this->createControllerMethodReader(); @@ -64,7 +64,7 @@ public function testRead() $this->assertSame($expected, $routes); } - public function testReadDefaultController() + public function testReadDefaultController(): void { $reader = $this->createControllerMethodReader( 'CodeIgniter\Commands\Utilities\Routes\AutoRouterImproved\Controllers' @@ -99,7 +99,7 @@ public function testReadDefaultController() $this->assertSame($expected, $routes); } - public function testReadControllerWithRemap() + public function testReadControllerWithRemap(): void { $reader = $this->createControllerMethodReader(); diff --git a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/Controllers/Home.php b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/Controllers/Home.php index 4666a709a07b..f4836ffc7f6a 100644 --- a/tests/system/Commands/Utilities/Routes/AutoRouterImproved/Controllers/Home.php +++ b/tests/system/Commands/Utilities/Routes/AutoRouterImproved/Controllers/Home.php @@ -18,18 +18,18 @@ */ class Home extends Controller { - public function getIndex() + public function getIndex(): void { } - public function postIndex() + public function postIndex(): void { } /** * This method cannot be accessible. */ - public function getFoo() + public function getFoo(): void { } } diff --git a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php index 32a2bd54ab1c..fecc080d8705 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerFinderTest.php @@ -21,7 +21,7 @@ */ final class ControllerFinderTest extends CIUnitTestCase { - public function testFind() + public function testFind(): void { $namespace = 'Tests\Support\Controllers'; $finder = new ControllerFinder($namespace); diff --git a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php index ee315135304d..349d814b23c7 100644 --- a/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php +++ b/tests/system/Commands/Utilities/Routes/ControllerMethodReaderTest.php @@ -22,7 +22,7 @@ */ final class ControllerMethodReaderTest extends CIUnitTestCase { - public function testRead() + public function testRead(): void { $namespace = 'Tests\Support\Controllers'; $reader = new ControllerMethodReader($namespace); @@ -90,7 +90,7 @@ public function testRead() $this->assertSame($expected, $routes); } - public function testReadControllerWithRemap() + public function testReadControllerWithRemap(): void { $namespace = 'Tests\Support\Controllers'; $reader = new ControllerMethodReader($namespace); diff --git a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php index ff4df4090c4c..1363d468a49d 100644 --- a/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterCollectorTest.php @@ -21,7 +21,7 @@ */ final class FilterCollectorTest extends CIUnitTestCase { - public function testGet() + public function testGet(): void { $routes = Services::routes(); $routes->resetRoutes(); diff --git a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php index ace71d9d7e2d..15b970cd4351 100644 --- a/tests/system/Commands/Utilities/Routes/FilterFinderTest.php +++ b/tests/system/Commands/Utilities/Routes/FilterFinderTest.php @@ -96,7 +96,7 @@ private function createFilters(array $config = []): Filters return new Filters($filtersConfig, $this->request, $this->response, $this->moduleConfig); } - public function testFindGlobalsFilters() + public function testFindGlobalsFilters(): void { $collection = $this->createRouteCollection(); $router = $this->createRouter($collection); @@ -113,7 +113,7 @@ public function testFindGlobalsFilters() $this->assertSame($expected, $filters); } - public function testFindGlobalsFiltersWithRedirectRoute() + public function testFindGlobalsFiltersWithRedirectRoute(): void { $collection = $this->createRouteCollection(); $collection->addRedirect('users/about', 'profile'); @@ -132,7 +132,7 @@ public function testFindGlobalsFiltersWithRedirectRoute() $this->assertSame($expected, $filters); } - public function testFindGlobalsAndRouteFilters() + public function testFindGlobalsAndRouteFilters(): void { $collection = $this->createRouteCollection(); $collection->get('admin', ' AdminController::index', ['filter' => 'honeypot']); @@ -150,7 +150,7 @@ public function testFindGlobalsAndRouteFilters() $this->assertSame($expected, $filters); } - public function testFindGlobalsAndRouteClassnameFilters() + public function testFindGlobalsAndRouteClassnameFilters(): void { $collection = $this->createRouteCollection(); $collection->get('admin', ' AdminController::index', ['filter' => InvalidChars::class]); @@ -168,7 +168,7 @@ public function testFindGlobalsAndRouteClassnameFilters() $this->assertSame($expected, $filters); } - public function testFindGlobalsAndRouteMultipleFilters() + public function testFindGlobalsAndRouteMultipleFilters(): void { config('Feature')->multipleFilters = true; diff --git a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php index fe7bf12613a7..ec4acc47259e 100644 --- a/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php +++ b/tests/system/Commands/Utilities/Routes/SampleURIGeneratorTest.php @@ -24,7 +24,7 @@ final class SampleURIGeneratorTest extends CIUnitTestCase /** * @dataProvider routeKeyProvider */ - public function testGet(string $routeKey, string $expected) + public function testGet(string $routeKey, string $expected): void { $generator = new SampleURIGenerator(); @@ -44,7 +44,7 @@ public function routeKeyProvider(): iterable ]; } - public function testGetFromPlaceholderCustomPlaceholder() + public function testGetFromPlaceholderCustomPlaceholder(): void { $routes = Services::routes(); $routes->addPlaceholder( diff --git a/tests/system/Commands/ValidationGeneratorTest.php b/tests/system/Commands/ValidationGeneratorTest.php index 39c3fd833a5f..ec208179be79 100644 --- a/tests/system/Commands/ValidationGeneratorTest.php +++ b/tests/system/Commands/ValidationGeneratorTest.php @@ -38,13 +38,13 @@ protected function tearDown(): void } } - public function testGenerateValidation() + public function testGenerateValidation(): void { command('make:validation user'); $this->assertFileExists(APPPATH . 'Validation/User.php'); } - public function testGenerateValidationWithOptionSuffix() + public function testGenerateValidationWithOptionSuffix(): void { command('make:validation admin -suffix'); $this->assertFileExists(APPPATH . 'Validation/AdminValidation.php'); diff --git a/tests/system/CommonFunctionsSendTest.php b/tests/system/CommonFunctionsSendTest.php index 365049315778..a580366277fb 100644 --- a/tests/system/CommonFunctionsSendTest.php +++ b/tests/system/CommonFunctionsSendTest.php @@ -34,7 +34,7 @@ protected function setUp(): void * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testRedirectResponseCookiesSent() + public function testRedirectResponseCookiesSent(): void { $loginTime = time(); diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index b304eeab69eb..8d4f7199d0e1 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -56,7 +56,7 @@ protected function setUp(): void parent::setUp(); } - public function testStringifyAttributes() + public function testStringifyAttributes(): void { $this->assertSame(' class="foo" id="bar"', stringify_attributes(['class' => 'foo', 'id' => 'bar'])); @@ -73,7 +73,7 @@ public function testStringifyAttributes() $this->assertSame('', stringify_attributes([])); } - public function testStringifyJsAttributes() + public function testStringifyJsAttributes(): void { $this->assertSame('width=800,height=600', stringify_attributes(['width' => '800', 'height' => '600'], true)); @@ -83,26 +83,26 @@ public function testStringifyJsAttributes() $this->assertSame('width=800,height=600', stringify_attributes($atts, true)); } - public function testEnvReturnsDefault() + public function testEnvReturnsDefault(): void { $this->assertSame('baz', env('foo', 'baz')); } - public function testEnvGetsFromSERVER() + public function testEnvGetsFromSERVER(): void { $_SERVER['foo'] = 'bar'; $this->assertSame('bar', env('foo', 'baz')); } - public function testEnvGetsFromENV() + public function testEnvGetsFromENV(): void { $_ENV['foo'] = 'bar'; $this->assertSame('bar', env('foo', 'baz')); } - public function testEnvBooleans() + public function testEnvBooleans(): void { $_ENV['p1'] = 'true'; $_ENV['p2'] = 'false'; @@ -115,7 +115,7 @@ public function testEnvBooleans() $this->assertNull(env('p4')); } - public function testRedirectReturnsRedirectResponse() + public function testRedirectReturnsRedirectResponse(): void { $_SERVER['REQUEST_METHOD'] = 'GET'; @@ -133,12 +133,12 @@ public function testRedirectReturnsRedirectResponse() $this->assertInstanceOf(RedirectResponse::class, redirect('base')); } - public function testRedirectDefault() + public function testRedirectDefault(): void { $this->assertInstanceOf(RedirectResponse::class, redirect()); } - public function testRequestIncomingRequest() + public function testRequestIncomingRequest(): void { Services::createRequest(new App()); @@ -147,7 +147,7 @@ public function testRequestIncomingRequest() $this->assertInstanceOf(IncomingRequest::class, $request); } - public function testRequestCLIRequest() + public function testRequestCLIRequest(): void { Services::createRequest(new App(), true); @@ -156,19 +156,19 @@ public function testRequestCLIRequest() $this->assertInstanceOf(CLIRequest::class, $request); } - public function testResponse() + public function testResponse(): void { $response = response(); $this->assertInstanceOf(Response::class, $response); } - public function testSolidusElement() + public function testSolidusElement(): void { $this->assertSame('', _solidus()); } - public function testSolidusElementXHTML() + public function testSolidusElementXHTML(): void { $doctypes = config('DocTypes'); $default = $doctypes->html5; @@ -180,7 +180,7 @@ public function testSolidusElementXHTML() $doctypes->html5 = $default; } - public function testView() + public function testView(): void { $data = [ 'testString' => 'bar', @@ -190,7 +190,7 @@ public function testView() $this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple', $data)); } - public function testViewSavedData() + public function testViewSavedData(): void { $data = [ 'testString' => 'bar', @@ -201,26 +201,26 @@ public function testViewSavedData() $this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple')); } - public function testViewCell() + public function testViewCell(): void { $expected = 'Hello'; $this->assertSame($expected, view_cell('\Tests\Support\View\SampleClass::hello')); } - public function testEscapeWithDifferentEncodings() + public function testEscapeWithDifferentEncodings(): void { $this->assertSame('<x', esc('assertSame('<x', esc('assertSame('<x', esc('expectException('InvalidArgumentException'); esc(['width' => '800', 'height' => '600'], 'bogus'); } - public function testEscapeBadContextZero() + public function testEscapeBadContextZero(): void { $this->expectException('InvalidArgumentException'); esc('', 'http://example.com'); @@ -337,7 +337,7 @@ public function testRequestMethodGetsSanitized() $this->assertSame('CUSTOM', $options[CURLOPT_CUSTOMREQUEST]); } - public function testRequestSetsBasicCurlOptions() + public function testRequestSetsBasicCurlOptions(): void { $this->request->request('get', 'http://example.com'); @@ -362,7 +362,7 @@ public function testRequestSetsBasicCurlOptions() $this->assertSame(150000.0, $options[CURLOPT_CONNECTTIMEOUT_MS]); } - public function testAuthBasicOption() + public function testAuthBasicOption(): void { $this->request->request('get', 'http://example.com', [ 'auth' => [ @@ -380,7 +380,7 @@ public function testAuthBasicOption() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testAuthBasicOptionExplicit() + public function testAuthBasicOptionExplicit(): void { $this->request->request('get', 'http://example.com', [ 'auth' => [ @@ -399,7 +399,7 @@ public function testAuthBasicOptionExplicit() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testAuthDigestOption() + public function testAuthDigestOption(): void { $output = "HTTP/1.1 401 Unauthorized Server: ddos-guard @@ -439,7 +439,7 @@ public function testAuthDigestOption() $this->assertSame(CURLAUTH_DIGEST, $options[CURLOPT_HTTPAUTH]); } - public function testSetAuthBasic() + public function testSetAuthBasic(): void { $this->request->setAuth('username', 'password')->get('http://example.com'); @@ -452,7 +452,7 @@ public function testSetAuthBasic() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testSetAuthDigest() + public function testSetAuthDigest(): void { $output = "HTTP/1.1 401 Unauthorized Server: ddos-guard @@ -486,7 +486,7 @@ public function testSetAuthDigest() $this->assertSame(CURLAUTH_DIGEST, $options[CURLOPT_HTTPAUTH]); } - public function testCertOption() + public function testCertOption(): void { $file = __FILE__; @@ -500,7 +500,7 @@ public function testCertOption() $this->assertSame($file, $options[CURLOPT_SSLCERT]); } - public function testCertOptionWithPassword() + public function testCertOptionWithPassword(): void { $file = __FILE__; @@ -520,7 +520,7 @@ public function testCertOptionWithPassword() $this->assertSame('password', $options[CURLOPT_SSLCERTPASSWD]); } - public function testMissingCertOption() + public function testMissingCertOption(): void { $file = 'something_obviously_bogus'; $this->expectException(HTTPException::class); @@ -530,7 +530,7 @@ public function testMissingCertOption() ]); } - public function testSSLVerification() + public function testSSLVerification(): void { $file = __FILE__; @@ -548,7 +548,7 @@ public function testSSLVerification() $this->assertSame(1, $options[CURLOPT_SSL_VERIFYPEER]); } - public function testSSLWithBadKey() + public function testSSLWithBadKey(): void { $file = 'something_obviously_bogus'; $this->expectException(HTTPException::class); @@ -559,7 +559,7 @@ public function testSSLWithBadKey() ]); } - public function testDebugOptionTrue() + public function testDebugOptionTrue(): void { $this->request->request('get', 'http://example.com', [ 'debug' => true, @@ -574,7 +574,7 @@ public function testDebugOptionTrue() $this->assertIsResource($options[CURLOPT_STDERR]); } - public function testDebugOptionFalse() + public function testDebugOptionFalse(): void { $this->request->request('get', 'http://example.com', [ 'debug' => false, @@ -586,7 +586,7 @@ public function testDebugOptionFalse() $this->assertArrayNotHasKey(CURLOPT_STDERR, $options); } - public function testDebugOptionFile() + public function testDebugOptionFile(): void { $file = SUPPORTPATH . 'Files/baker/banana.php'; @@ -603,7 +603,7 @@ public function testDebugOptionFile() $this->assertIsResource($options[CURLOPT_STDERR]); } - public function testDecodeContent() + public function testDecodeContent(): void { $this->request->setHeader('Accept-Encoding', 'cobol'); $this->request->request('get', 'http://example.com', [ @@ -616,7 +616,7 @@ public function testDecodeContent() $this->assertSame('cobol', $options[CURLOPT_ENCODING]); } - public function testDecodeContentWithoutAccept() + public function testDecodeContentWithoutAccept(): void { // $this->request->setHeader('Accept-Encoding', 'cobol'); $this->request->request('get', 'http://example.com', [ @@ -631,7 +631,7 @@ public function testDecodeContentWithoutAccept() $this->assertSame('Accept-Encoding', $options[CURLOPT_HTTPHEADER]); } - public function testAllowRedirectsOptionFalse() + public function testAllowRedirectsOptionFalse(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => false, @@ -646,7 +646,7 @@ public function testAllowRedirectsOptionFalse() $this->assertArrayNotHasKey(CURLOPT_REDIR_PROTOCOLS, $options); } - public function testAllowRedirectsOptionTrue() + public function testAllowRedirectsOptionTrue(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => true, @@ -663,7 +663,7 @@ public function testAllowRedirectsOptionTrue() $this->assertSame(CURLPROTO_HTTP | CURLPROTO_HTTPS, $options[CURLOPT_REDIR_PROTOCOLS]); } - public function testAllowRedirectsOptionDefaults() + public function testAllowRedirectsOptionDefaults(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => true, @@ -678,7 +678,7 @@ public function testAllowRedirectsOptionDefaults() $this->assertArrayHasKey(CURLOPT_REDIR_PROTOCOLS, $options); } - public function testAllowRedirectsArray() + public function testAllowRedirectsArray(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => ['max' => 2], @@ -693,7 +693,7 @@ public function testAllowRedirectsArray() $this->assertSame(2, $options[CURLOPT_MAXREDIRS]); } - public function testSendWithQuery() + public function testSendWithQuery(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -710,7 +710,7 @@ public function testSendWithQuery() $this->assertSame('http://www.foo.com/api/v1/products?name=Henry&d.t=value', $options[CURLOPT_URL]); } - public function testSendWithDelay() + public function testSendWithDelay(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -723,7 +723,7 @@ public function testSendWithDelay() $this->assertSame(0.1, $request->getDelay()); } - public function testSendContinued() + public function testSendContinued(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -738,7 +738,7 @@ public function testSendContinued() /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/3261 */ - public function testSendContinuedWithManyHeaders() + public function testSendContinuedWithManyHeaders(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -785,7 +785,7 @@ public function testSendContinuedWithManyHeaders() /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/7394 */ - public function testResponseHeadersWithMultipleRequests() + public function testResponseHeadersWithMultipleRequests(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -838,7 +838,7 @@ public function testResponseHeadersWithMultipleRequests() $this->assertSame(200, $response->getStatusCode()); } - public function testSplitResponse() + public function testSplitResponse(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -850,7 +850,7 @@ public function testSplitResponse() $this->assertSame('Hi there', $response->getBody()); } - public function testApplyBody() + public function testApplyBody(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -865,7 +865,7 @@ public function testApplyBody() $this->assertSame('name=George', $request->curl_options[CURLOPT_POSTFIELDS]); } - public function testApplyBodyByOptions() + public function testApplyBodyByOptions(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -881,7 +881,7 @@ public function testApplyBodyByOptions() $this->assertSame('name=George', $request->curl_options[CURLOPT_POSTFIELDS]); } - public function testBodyIsResetOnSecondRequest() + public function testBodyIsResetOnSecondRequest(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -896,7 +896,7 @@ public function testBodyIsResetOnSecondRequest() $this->assertArrayNotHasKey(CURLOPT_POSTFIELDS, $request->curl_options); } - public function testResponseHeaders() + public function testResponseHeaders(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -910,7 +910,7 @@ public function testResponseHeaders() $this->assertSame(234, $response->getStatusCode()); } - public function testResponseHeadersShortProtocol() + public function testResponseHeadersShortProtocol(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -924,7 +924,7 @@ public function testResponseHeadersShortProtocol() $this->assertSame(235, $response->getStatusCode()); } - public function testPostFormEncoded() + public function testPostFormEncoded(): void { $params = [ 'foo' => 'bar', @@ -946,7 +946,7 @@ public function testPostFormEncoded() $this->assertSame($expected, $options[CURLOPT_POSTFIELDS]); } - public function testPostFormMultipart() + public function testPostFormMultipart(): void { $params = [ 'foo' => 'bar', @@ -968,7 +968,7 @@ public function testPostFormMultipart() $this->assertSame($params, $options[CURLOPT_POSTFIELDS]); } - public function testSetForm() + public function testSetForm(): void { $params = [ 'foo' => 'bar', @@ -995,7 +995,7 @@ public function testSetForm() ); } - public function testJSONData() + public function testJSONData(): void { $params = [ 'foo' => 'bar', @@ -1017,7 +1017,7 @@ public function testJSONData() ); } - public function testSetJSON() + public function testSetJSON(): void { $params = [ 'foo' => 'bar', @@ -1040,7 +1040,7 @@ public function testSetJSON() ); } - public function testHTTPv1() + public function testHTTPv1(): void { $this->request->request('POST', '/post', [ 'version' => 1.0, @@ -1052,7 +1052,7 @@ public function testHTTPv1() $this->assertSame(CURL_HTTP_VERSION_1_0, $options[CURLOPT_HTTP_VERSION]); } - public function testHTTPv11() + public function testHTTPv11(): void { $this->request->request('POST', '/post', [ 'version' => 1.1, @@ -1064,7 +1064,7 @@ public function testHTTPv11() $this->assertSame(CURL_HTTP_VERSION_1_1, $options[CURLOPT_HTTP_VERSION]); } - public function testCookieOption() + public function testCookieOption(): void { $holder = SUPPORTPATH . 'HTTP/Files/CookiesHolder.txt'; $this->request->request('POST', '/post', [ @@ -1079,7 +1079,7 @@ public function testCookieOption() $this->assertSame($holder, $options[CURLOPT_COOKIEFILE]); } - public function testUserAgentOption() + public function testUserAgentOption(): void { $agent = 'CodeIgniter Framework'; diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index d90b8847cbb6..415032d19628 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -52,7 +52,7 @@ protected function getRequest(array $options = []) /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/4707 */ - public function testPrepareURLIgnoresAppConfig() + public function testPrepareURLIgnoresAppConfig(): void { config('App')->baseURL = 'http://example.com/fruit/'; @@ -66,7 +66,7 @@ public function testPrepareURLIgnoresAppConfig() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1029 */ - public function testGetRemembersBaseURI() + public function testGetRemembersBaseURI(): void { $request = $this->getRequest(['base_uri' => 'http://www.foo.com/api/v1/']); @@ -80,7 +80,7 @@ public function testGetRemembersBaseURI() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1029 */ - public function testGetRemembersBaseURIWithHelperMethod() + public function testGetRemembersBaseURIWithHelperMethod(): void { $request = Services::curlrequest(['base_uri' => 'http://www.foo.com/api/v1/']); @@ -89,7 +89,7 @@ public function testGetRemembersBaseURIWithHelperMethod() $this->assertSame('/api/v1/', $uri->getPath()); } - public function testSendReturnsResponse() + public function testSendReturnsResponse(): void { $output = 'Howdy Stranger.'; @@ -99,7 +99,7 @@ public function testSendReturnsResponse() $this->assertSame($output, $response->getBody()); } - public function testGetSetsCorrectMethod() + public function testGetSetsCorrectMethod(): void { $this->request->get('http://example.com'); @@ -111,7 +111,7 @@ public function testGetSetsCorrectMethod() $this->assertSame('GET', $options[CURLOPT_CUSTOMREQUEST]); } - public function testDeleteSetsCorrectMethod() + public function testDeleteSetsCorrectMethod(): void { $this->request->delete('http://example.com'); @@ -123,7 +123,7 @@ public function testDeleteSetsCorrectMethod() $this->assertSame('DELETE', $options[CURLOPT_CUSTOMREQUEST]); } - public function testHeadSetsCorrectMethod() + public function testHeadSetsCorrectMethod(): void { $this->request->head('http://example.com'); @@ -135,7 +135,7 @@ public function testHeadSetsCorrectMethod() $this->assertSame('HEAD', $options[CURLOPT_CUSTOMREQUEST]); } - public function testOptionsSetsCorrectMethod() + public function testOptionsSetsCorrectMethod(): void { $this->request->options('http://example.com'); @@ -147,7 +147,7 @@ public function testOptionsSetsCorrectMethod() $this->assertSame('OPTIONS', $options[CURLOPT_CUSTOMREQUEST]); } - public function testOptionsBaseURIOption() + public function testOptionsBaseURIOption(): void { $options = ['base_uri' => 'http://www.foo.com/api/v1/']; $request = $this->getRequest($options); @@ -155,7 +155,7 @@ public function testOptionsBaseURIOption() $this->assertSame('http://www.foo.com/api/v1/', $request->getBaseURI()->__toString()); } - public function testOptionsBaseURIOverride() + public function testOptionsBaseURIOverride(): void { $options = [ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -166,7 +166,7 @@ public function testOptionsBaseURIOverride() $this->assertSame('http://bogus/com', $request->getBaseURI()->__toString()); } - public function testOptionsHeaders() + public function testOptionsHeaders(): void { $options = [ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -182,7 +182,7 @@ public function testOptionsHeaders() /** * @backupGlobals enabled */ - public function testOptionsHeadersNotUsingPopulate() + public function testOptionsHeadersNotUsingPopulate(): void { $_SERVER['HTTP_HOST'] = 'site1.com'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US'; @@ -203,7 +203,7 @@ public function testOptionsHeadersNotUsingPopulate() $this->assertSame('', $request->header('Accept-Encoding')->getValue()); } - public function testOptionsAreSharedBetweenRequests() + public function testOptionsAreSharedBetweenRequests(): void { $options = [ 'form_params' => ['studio' => 1], @@ -227,7 +227,7 @@ public function testOptionsAreSharedBetweenRequests() /** * @backupGlobals enabled */ - public function testHeaderContentLengthNotSharedBetweenClients() + public function testHeaderContentLengthNotSharedBetweenClients(): void { $_SERVER['HTTP_CONTENT_LENGTH'] = '10'; @@ -247,7 +247,7 @@ public function testHeaderContentLengthNotSharedBetweenClients() $this->assertNull($request->header('Content-Length')); } - public function testOptionsDelay() + public function testOptionsDelay(): void { $request = $this->getRequest(); $this->assertSame(0.0, $request->getDelay()); @@ -260,7 +260,7 @@ public function testOptionsDelay() $this->assertSame(2.0, $request->getDelay()); } - public function testPatchSetsCorrectMethod() + public function testPatchSetsCorrectMethod(): void { $this->request->patch('http://example.com'); @@ -272,7 +272,7 @@ public function testPatchSetsCorrectMethod() $this->assertSame('PATCH', $options[CURLOPT_CUSTOMREQUEST]); } - public function testPostSetsCorrectMethod() + public function testPostSetsCorrectMethod(): void { $this->request->post('http://example.com'); @@ -284,7 +284,7 @@ public function testPostSetsCorrectMethod() $this->assertSame('POST', $options[CURLOPT_CUSTOMREQUEST]); } - public function testPutSetsCorrectMethod() + public function testPutSetsCorrectMethod(): void { $this->request->put('http://example.com'); @@ -296,7 +296,7 @@ public function testPutSetsCorrectMethod() $this->assertSame('PUT', $options[CURLOPT_CUSTOMREQUEST]); } - public function testCustomMethodSetsCorrectMethod() + public function testCustomMethodSetsCorrectMethod(): void { $this->request->request('custom', 'http://example.com'); @@ -308,7 +308,7 @@ public function testCustomMethodSetsCorrectMethod() $this->assertSame('CUSTOM', $options[CURLOPT_CUSTOMREQUEST]); } - public function testRequestMethodGetsSanitized() + public function testRequestMethodGetsSanitized(): void { $this->request->request('', 'http://example.com'); @@ -320,7 +320,7 @@ public function testRequestMethodGetsSanitized() $this->assertSame('CUSTOM', $options[CURLOPT_CUSTOMREQUEST]); } - public function testRequestSetsBasicCurlOptions() + public function testRequestSetsBasicCurlOptions(): void { $this->request->request('get', 'http://example.com'); @@ -345,7 +345,7 @@ public function testRequestSetsBasicCurlOptions() $this->assertSame(150000.0, $options[CURLOPT_CONNECTTIMEOUT_MS]); } - public function testAuthBasicOption() + public function testAuthBasicOption(): void { $this->request->request('get', 'http://example.com', [ 'auth' => [ @@ -363,7 +363,7 @@ public function testAuthBasicOption() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testAuthBasicOptionExplicit() + public function testAuthBasicOptionExplicit(): void { $this->request->request('get', 'http://example.com', [ 'auth' => [ @@ -382,7 +382,7 @@ public function testAuthBasicOptionExplicit() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testAuthDigestOption() + public function testAuthDigestOption(): void { $output = "HTTP/1.1 401 Unauthorized Server: ddos-guard @@ -422,7 +422,7 @@ public function testAuthDigestOption() $this->assertSame(CURLAUTH_DIGEST, $options[CURLOPT_HTTPAUTH]); } - public function testSetAuthBasic() + public function testSetAuthBasic(): void { $this->request->setAuth('username', 'password')->get('http://example.com'); @@ -435,7 +435,7 @@ public function testSetAuthBasic() $this->assertSame(CURLAUTH_BASIC, $options[CURLOPT_HTTPAUTH]); } - public function testSetAuthDigest() + public function testSetAuthDigest(): void { $output = "HTTP/1.1 401 Unauthorized Server: ddos-guard @@ -469,7 +469,7 @@ public function testSetAuthDigest() $this->assertSame(CURLAUTH_DIGEST, $options[CURLOPT_HTTPAUTH]); } - public function testCertOption() + public function testCertOption(): void { $file = __FILE__; @@ -483,7 +483,7 @@ public function testCertOption() $this->assertSame($file, $options[CURLOPT_SSLCERT]); } - public function testCertOptionWithPassword() + public function testCertOptionWithPassword(): void { $file = __FILE__; @@ -503,7 +503,7 @@ public function testCertOptionWithPassword() $this->assertSame('password', $options[CURLOPT_SSLCERTPASSWD]); } - public function testMissingCertOption() + public function testMissingCertOption(): void { $file = 'something_obviously_bogus'; $this->expectException(HTTPException::class); @@ -513,7 +513,7 @@ public function testMissingCertOption() ]); } - public function testSSLVerification() + public function testSSLVerification(): void { $file = __FILE__; @@ -531,7 +531,7 @@ public function testSSLVerification() $this->assertSame(1, $options[CURLOPT_SSL_VERIFYPEER]); } - public function testSSLWithBadKey() + public function testSSLWithBadKey(): void { $file = 'something_obviously_bogus'; $this->expectException(HTTPException::class); @@ -542,7 +542,7 @@ public function testSSLWithBadKey() ]); } - public function testDebugOptionTrue() + public function testDebugOptionTrue(): void { $this->request->request('get', 'http://example.com', [ 'debug' => true, @@ -557,7 +557,7 @@ public function testDebugOptionTrue() $this->assertIsResource($options[CURLOPT_STDERR]); } - public function testDebugOptionFalse() + public function testDebugOptionFalse(): void { $this->request->request('get', 'http://example.com', [ 'debug' => false, @@ -569,7 +569,7 @@ public function testDebugOptionFalse() $this->assertArrayNotHasKey(CURLOPT_STDERR, $options); } - public function testDebugOptionFile() + public function testDebugOptionFile(): void { $file = SUPPORTPATH . 'Files/baker/banana.php'; @@ -586,7 +586,7 @@ public function testDebugOptionFile() $this->assertIsResource($options[CURLOPT_STDERR]); } - public function testDecodeContent() + public function testDecodeContent(): void { $this->request->setHeader('Accept-Encoding', 'cobol'); $this->request->request('get', 'http://example.com', [ @@ -599,7 +599,7 @@ public function testDecodeContent() $this->assertSame('cobol', $options[CURLOPT_ENCODING]); } - public function testDecodeContentWithoutAccept() + public function testDecodeContentWithoutAccept(): void { // $this->request->setHeader('Accept-Encoding', 'cobol'); $this->request->request('get', 'http://example.com', [ @@ -614,7 +614,7 @@ public function testDecodeContentWithoutAccept() $this->assertSame('Accept-Encoding', $options[CURLOPT_HTTPHEADER]); } - public function testAllowRedirectsOptionFalse() + public function testAllowRedirectsOptionFalse(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => false, @@ -629,7 +629,7 @@ public function testAllowRedirectsOptionFalse() $this->assertArrayNotHasKey(CURLOPT_REDIR_PROTOCOLS, $options); } - public function testAllowRedirectsOptionTrue() + public function testAllowRedirectsOptionTrue(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => true, @@ -646,7 +646,7 @@ public function testAllowRedirectsOptionTrue() $this->assertSame(CURLPROTO_HTTP | CURLPROTO_HTTPS, $options[CURLOPT_REDIR_PROTOCOLS]); } - public function testAllowRedirectsOptionDefaults() + public function testAllowRedirectsOptionDefaults(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => true, @@ -661,7 +661,7 @@ public function testAllowRedirectsOptionDefaults() $this->assertArrayHasKey(CURLOPT_REDIR_PROTOCOLS, $options); } - public function testAllowRedirectsArray() + public function testAllowRedirectsArray(): void { $this->request->request('get', 'http://example.com', [ 'allow_redirects' => ['max' => 2], @@ -676,7 +676,7 @@ public function testAllowRedirectsArray() $this->assertSame(2, $options[CURLOPT_MAXREDIRS]); } - public function testSendWithQuery() + public function testSendWithQuery(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -693,7 +693,7 @@ public function testSendWithQuery() $this->assertSame('http://www.foo.com/api/v1/products?name=Henry&d.t=value', $options[CURLOPT_URL]); } - public function testSendWithDelay() + public function testSendWithDelay(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -706,7 +706,7 @@ public function testSendWithDelay() $this->assertSame(0.1, $request->getDelay()); } - public function testSendContinued() + public function testSendContinued(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -721,7 +721,7 @@ public function testSendContinued() /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/3261 */ - public function testSendContinuedWithManyHeaders() + public function testSendContinuedWithManyHeaders(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -765,7 +765,7 @@ public function testSendContinuedWithManyHeaders() $this->assertSame(200, $response->getStatusCode()); } - public function testSendProxied() + public function testSendProxied(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -783,7 +783,7 @@ public function testSendProxied() /** * See: https://github.com/codeigniter4/CodeIgniter4/issues/7394 */ - public function testResponseHeadersWithMultipleRequests() + public function testResponseHeadersWithMultipleRequests(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -836,7 +836,7 @@ public function testResponseHeadersWithMultipleRequests() $this->assertSame(200, $response->getStatusCode()); } - public function testSplitResponse() + public function testSplitResponse(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -848,7 +848,7 @@ public function testSplitResponse() $this->assertSame('Hi there', $response->getBody()); } - public function testApplyBody() + public function testApplyBody(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -863,7 +863,7 @@ public function testApplyBody() $this->assertSame('name=George', $request->curl_options[CURLOPT_POSTFIELDS]); } - public function testApplyBodyByOptions() + public function testApplyBodyByOptions(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -879,7 +879,7 @@ public function testApplyBodyByOptions() $this->assertSame('name=George', $request->curl_options[CURLOPT_POSTFIELDS]); } - public function testResponseHeaders() + public function testResponseHeaders(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -893,7 +893,7 @@ public function testResponseHeaders() $this->assertSame(234, $response->getStatusCode()); } - public function testResponseHeadersShortProtocol() + public function testResponseHeadersShortProtocol(): void { $request = $this->getRequest([ 'base_uri' => 'http://www.foo.com/api/v1/', @@ -907,7 +907,7 @@ public function testResponseHeadersShortProtocol() $this->assertSame(235, $response->getStatusCode()); } - public function testPostFormEncoded() + public function testPostFormEncoded(): void { $params = [ 'foo' => 'bar', @@ -929,7 +929,7 @@ public function testPostFormEncoded() $this->assertSame($expected, $options[CURLOPT_POSTFIELDS]); } - public function testPostFormMultipart() + public function testPostFormMultipart(): void { $params = [ 'foo' => 'bar', @@ -951,7 +951,7 @@ public function testPostFormMultipart() $this->assertSame($params, $options[CURLOPT_POSTFIELDS]); } - public function testSetForm() + public function testSetForm(): void { $params = [ 'foo' => 'bar', @@ -978,7 +978,7 @@ public function testSetForm() ); } - public function testJSONData() + public function testJSONData(): void { $params = [ 'foo' => 'bar', @@ -997,7 +997,7 @@ public function testJSONData() $this->assertSame($expected, $this->request->getBody()); } - public function testSetJSON() + public function testSetJSON(): void { $params = [ 'foo' => 'bar', @@ -1015,7 +1015,7 @@ public function testSetJSON() ); } - public function testHTTPv1() + public function testHTTPv1(): void { $this->request->request('POST', '/post', [ 'version' => 1.0, @@ -1027,7 +1027,7 @@ public function testHTTPv1() $this->assertSame(CURL_HTTP_VERSION_1_0, $options[CURLOPT_HTTP_VERSION]); } - public function testHTTPv11() + public function testHTTPv11(): void { $this->request->request('POST', '/post', [ 'version' => 1.1, @@ -1039,7 +1039,7 @@ public function testHTTPv11() $this->assertSame(CURL_HTTP_VERSION_1_1, $options[CURLOPT_HTTP_VERSION]); } - public function testHTTPv2() + public function testHTTPv2(): void { $this->request->request('POST', '/post', [ 'version' => 2.0, @@ -1051,7 +1051,7 @@ public function testHTTPv2() $this->assertSame(CURL_HTTP_VERSION_2_0, $options[CURLOPT_HTTP_VERSION]); } - public function testCookieOption() + public function testCookieOption(): void { $holder = SUPPORTPATH . 'HTTP/Files/CookiesHolder.txt'; $this->request->request('POST', '/post', [ @@ -1066,7 +1066,7 @@ public function testCookieOption() $this->assertSame($holder, $options[CURLOPT_COOKIEFILE]); } - public function testUserAgentOption() + public function testUserAgentOption(): void { $agent = 'CodeIgniter Framework'; diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 4b4d7a1a4975..81fd2d998602 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -32,7 +32,7 @@ final class ContentSecurityPolicyTest extends CIUnitTestCase private ?ContentSecurityPolicy $csp = null; // Having this method as setUp() doesn't work - can't find Config\App !? - protected function prepare(bool $CSPEnabled = true) + protected function prepare(bool $CSPEnabled = true): void { $this->resetServices(); @@ -63,7 +63,7 @@ protected function work(string $parm = 'Hello') * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testExistence() + public function testExistence(): void { $this->prepare(); $this->work(); @@ -75,7 +75,7 @@ public function testExistence() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testReportOnly() + public function testReportOnly(): void { $this->prepare(); $this->csp->reportOnly(false); @@ -88,7 +88,7 @@ public function testReportOnly() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testDefaults() + public function testDefaults(): void { $this->prepare(); @@ -107,7 +107,7 @@ public function testDefaults() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testChildSrc() + public function testChildSrc(): void { $this->prepare(); $this->csp->addChildSrc('evil.com', true); @@ -124,7 +124,7 @@ public function testChildSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testConnectSrc() + public function testConnectSrc(): void { $this->prepare(); $this->csp->reportOnly(true); @@ -140,7 +140,7 @@ public function testConnectSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testFontSrc() + public function testFontSrc(): void { $this->prepare(); $this->csp->reportOnly(true); @@ -158,7 +158,7 @@ public function testFontSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testFormAction() + public function testFormAction(): void { $this->prepare(); $this->csp->reportOnly(true); @@ -176,7 +176,7 @@ public function testFormAction() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testFrameAncestor() + public function testFrameAncestor(): void { $this->prepare(); $this->csp->addFrameAncestor('self'); @@ -193,7 +193,7 @@ public function testFrameAncestor() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testFrameSrc() + public function testFrameSrc(): void { $this->prepare(); $this->csp->addFrameSrc('self'); @@ -210,7 +210,7 @@ public function testFrameSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testImageSrc() + public function testImageSrc(): void { $this->prepare(); $this->csp->addImageSrc('cdn.cloudy.com'); @@ -227,7 +227,7 @@ public function testImageSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testMediaSrc() + public function testMediaSrc(): void { $this->prepare(); $this->csp->addMediaSrc('self'); @@ -244,7 +244,7 @@ public function testMediaSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testManifestSrc() + public function testManifestSrc(): void { $this->prepare(); $this->csp->addManifestSrc('cdn.cloudy.com'); @@ -261,7 +261,7 @@ public function testManifestSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testPluginType() + public function testPluginType(): void { $this->prepare(); $this->csp->addPluginType('self'); @@ -278,7 +278,7 @@ public function testPluginType() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testPluginArray() + public function testPluginArray(): void { $this->prepare(); $this->csp->addPluginType('application/x-shockwave-flash'); @@ -293,7 +293,7 @@ public function testPluginArray() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testObjectSrc() + public function testObjectSrc(): void { $this->prepare(); $this->csp->addObjectSrc('cdn.cloudy.com'); @@ -310,7 +310,7 @@ public function testObjectSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testScriptSrc() + public function testScriptSrc(): void { $this->prepare(); $this->csp->addScriptSrc('cdn.cloudy.com'); @@ -327,7 +327,7 @@ public function testScriptSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testStyleSrc() + public function testStyleSrc(): void { $this->prepare(); $this->csp->addStyleSrc('cdn.cloudy.com'); @@ -344,7 +344,7 @@ public function testStyleSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBaseURIDefault() + public function testBaseURIDefault(): void { $this->prepare(); $result = $this->work(); @@ -357,7 +357,7 @@ public function testBaseURIDefault() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBaseURI() + public function testBaseURI(): void { $this->prepare(); $this->csp->addBaseURI('example.com'); @@ -371,7 +371,7 @@ public function testBaseURI() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBaseURIRich() + public function testBaseURIRich(): void { $this->prepare(); $this->csp->addBaseURI(['self', 'example.com']); @@ -385,7 +385,7 @@ public function testBaseURIRich() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testDefaultSrc() + public function testDefaultSrc(): void { $this->prepare(); $this->csp->reportOnly(false); @@ -401,7 +401,7 @@ public function testDefaultSrc() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testReportURI() + public function testReportURI(): void { $this->prepare(); $this->csp->reportOnly(false); @@ -416,7 +416,7 @@ public function testReportURI() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testSandboxFlags() + public function testSandboxFlags(): void { $this->prepare(); $this->csp->reportOnly(false); @@ -432,7 +432,7 @@ public function testSandboxFlags() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testUpgradeInsecureRequests() + public function testUpgradeInsecureRequests(): void { $this->prepare(); $this->csp->upgradeInsecureRequests(); @@ -446,7 +446,7 @@ public function testUpgradeInsecureRequests() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBodyEmpty() + public function testBodyEmpty(): void { $this->prepare(); $body = ''; @@ -459,7 +459,7 @@ public function testBodyEmpty() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBodyScriptNonce() + public function testBodyScriptNonce(): void { $this->prepare(); $body = 'Blah blah {csp-script-nonce} blah blah'; @@ -478,7 +478,7 @@ public function testBodyScriptNonce() $this->assertSame([], $nonceStyle); } - public function testBodyScriptNonceCustomScriptTag() + public function testBodyScriptNonceCustomScriptTag(): void { $config = new CSPConfig(); $config->scriptNonceTag = '{custom-script-nonce-tag}'; @@ -494,7 +494,7 @@ public function testBodyScriptNonceCustomScriptTag() $this->assertStringContainsString('nonce=', $response->getBody()); } - public function testBodyScriptNonceDisableAutoNonce() + public function testBodyScriptNonceDisableAutoNonce(): void { $config = new CSPConfig(); $config->autoNonce = false; @@ -513,7 +513,7 @@ public function testBodyScriptNonceDisableAutoNonce() $result->assertHeader('Content-Security-Policy'); } - public function testBodyStyleNonceDisableAutoNonce() + public function testBodyStyleNonceDisableAutoNonce(): void { $config = new CSPConfig(); $config->autoNonce = false; @@ -536,7 +536,7 @@ public function testBodyStyleNonceDisableAutoNonce() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testBodyStyleNonce() + public function testBodyStyleNonce(): void { $this->prepare(); $body = 'Blah blah {csp-style-nonce} blah blah'; @@ -555,7 +555,7 @@ public function testBodyStyleNonce() $this->assertSame([], $nonceScript); } - public function testBodyStyleNonceCustomStyleTag() + public function testBodyStyleNonceCustomStyleTag(): void { $config = new CSPConfig(); $config->styleNonceTag = '{custom-style-nonce-tag}'; @@ -575,7 +575,7 @@ public function testBodyStyleNonceCustomStyleTag() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testHeaderWrongCaseNotFound() + public function testHeaderWrongCaseNotFound(): void { $this->prepare(); $result = $this->work(); @@ -588,7 +588,7 @@ public function testHeaderWrongCaseNotFound() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testHeaderIgnoreCase() + public function testHeaderIgnoreCase(): void { $this->prepare(); $result = $this->work(); @@ -601,7 +601,7 @@ public function testHeaderIgnoreCase() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testCSPDisabled() + public function testCSPDisabled(): void { $this->prepare(false); $this->work(); @@ -610,7 +610,7 @@ public function testCSPDisabled() $this->assertHeaderNotEmitted('content-security-policy', true); } - public function testGetScriptNonce() + public function testGetScriptNonce(): void { $this->prepare(); @@ -619,7 +619,7 @@ public function testGetScriptNonce() $this->assertMatchesRegularExpression('/\A[0-9a-z]{24}\z/', $nonce); } - public function testGetStyleNonce() + public function testGetStyleNonce(): void { $this->prepare(); @@ -632,7 +632,7 @@ public function testGetStyleNonce() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled() + public function testHeaderScriptNonceEmittedOnceGetScriptNonceCalled(): void { $this->prepare(); diff --git a/tests/system/HTTP/DownloadResponseTest.php b/tests/system/HTTP/DownloadResponseTest.php index fe320705b290..6bd699375a63 100644 --- a/tests/system/HTTP/DownloadResponseTest.php +++ b/tests/system/HTTP/DownloadResponseTest.php @@ -31,14 +31,14 @@ protected function tearDown(): void } } - public function testCanGetStatusCode() + public function testCanGetStatusCode(): void { $response = new DownloadResponse('unit-test.txt', true); $this->assertSame(200, $response->getStatusCode()); } - public function testCantSetStatusCode() + public function testCantSetStatusCode(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -46,7 +46,7 @@ public function testCantSetStatusCode() $response->setStatusCode(200); } - public function testSetDateRemembersDateInUTC() + public function testSetDateRemembersDateInUTC(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -61,7 +61,7 @@ public function testSetDateRemembersDateInUTC() $this->assertSame($date->format('D, d M Y H:i:s') . ' GMT', $header); } - public function testSetLastModifiedWithDateTimeObject() + public function testSetLastModifiedWithDateTimeObject(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -75,7 +75,7 @@ public function testSetLastModifiedWithDateTimeObject() $this->assertSame($date->format('D, d M Y H:i:s') . ' GMT', $header); } - public function testSetLastModifiedWithString() + public function testSetLastModifiedWithString(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -86,14 +86,14 @@ public function testSetLastModifiedWithString() $this->assertSame('2000-03-10 10:23:45', $header); } - public function testsentMethodSouldReturnRedirectResponse() + public function testsentMethodSouldReturnRedirectResponse(): void { $response = new DownloadResponse('unit-test.txt', true); $this->assertInstanceOf(DownloadResponse::class, $response); } - public function testSetContentType() + public function testSetContentType(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -102,7 +102,7 @@ public function testSetContentType() $this->assertSame('text/json; charset=UTF-8', $response->getHeaderLine('Content-Type')); } - public function testSetContentTypeNoCharSet() + public function testSetContentTypeNoCharSet(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -111,7 +111,7 @@ public function testSetContentTypeNoCharSet() $this->assertSame('application/octet-stream', $response->getHeaderLine('Content-Type')); } - public function testSetFileName() + public function testSetFileName(): void { $response = new DownloadResponse('unit-test.txt', true); $response->setFileName('myFile.txt'); @@ -120,7 +120,7 @@ public function testSetFileName() $this->assertSame('attachment; filename="myFile.txt"; filename*=UTF-8\'\'myFile.txt', $response->getHeaderLine('Content-Disposition')); } - public function testNoCache() + public function testNoCache(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -129,7 +129,7 @@ public function testNoCache() $this->assertSame('private, no-transform, no-store, must-revalidate', $response->getHeaderLine('Cache-control')); } - public function testCantSetCache() + public function testCantSetCache(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -137,7 +137,7 @@ public function testCantSetCache() $response->setCache(); } - public function testWhenFilepathIsSetBinaryCanNotBeSet() + public function testWhenFilepathIsSetBinaryCanNotBeSet(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -146,7 +146,7 @@ public function testWhenFilepathIsSetBinaryCanNotBeSet() $response->setBinary('test'); } - public function testWhenBinaryIsSetFilepathCanNotBeSet() + public function testWhenBinaryIsSetFilepathCanNotBeSet(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -155,7 +155,7 @@ public function testWhenBinaryIsSetFilepathCanNotBeSet() $response->setFilePath(__FILE__); } - public function testCanNotSetNoFilepath() + public function testCanNotSetNoFilepath(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -163,7 +163,7 @@ public function testCanNotSetNoFilepath() $response->setFilePath('unit test'); } - public function testCanGetContentLength() + public function testCanGetContentLength(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -181,7 +181,7 @@ public function testCanGetContentLength() $this->assertSame($size, $response->getContentLength()); } - public function testIsSetDownloadableHeadlersFromBinary() + public function testIsSetDownloadableHeadlersFromBinary(): void { $response = new DownloadResponse('unit test.txt', false); @@ -195,7 +195,7 @@ public function testIsSetDownloadableHeadlersFromBinary() $this->assertSame('4', $response->getHeaderLine('Content-Length')); } - public function testIsSetDownloadableHeadlersFromFile() + public function testIsSetDownloadableHeadlersFromFile(): void { $response = new DownloadResponse('unit-test.php', false); @@ -209,7 +209,7 @@ public function testIsSetDownloadableHeadlersFromFile() $this->assertSame(filesize(__FILE__), (int) $response->getHeaderLine('Content-Length')); } - public function testIfTheCharacterCodeIsOtherThanUtf8ReplaceItWithUtf8AndRawurlencode() + public function testIfTheCharacterCodeIsOtherThanUtf8ReplaceItWithUtf8AndRawurlencode(): void { $response = new DownloadResponse(mb_convert_encoding('テスト.php', 'Shift-JIS', 'UTF-8'), false); @@ -220,7 +220,7 @@ public function testIfTheCharacterCodeIsOtherThanUtf8ReplaceItWithUtf8AndRawurle $this->assertSame('attachment; filename="' . mb_convert_encoding('テスト.php', 'Shift-JIS', 'UTF-8') . '"; filename*=UTF-8\'\'%E3%83%86%E3%82%B9%E3%83%88.php', $response->getHeaderLine('Content-Disposition')); } - public function testFileExtensionIsUpperCaseWhenAndroidOSIs2() + public function testFileExtensionIsUpperCaseWhenAndroidOSIs2(): void { $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Linux; U; Android 2.0.3; ja-jp; SC-02C Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'; $response = new DownloadResponse('unit-test.php', false); @@ -231,7 +231,7 @@ public function testFileExtensionIsUpperCaseWhenAndroidOSIs2() $this->assertSame('attachment; filename="unit-test.PHP"; filename*=UTF-8\'\'unit-test.PHP', $response->getHeaderLine('Content-Disposition')); } - public function testIsSetContentTypeFromFilename() + public function testIsSetContentTypeFromFilename(): void { $response = new DownloadResponse('unit-test.txt', true); @@ -241,7 +241,7 @@ public function testIsSetContentTypeFromFilename() $this->assertSame('text/plain; charset=UTF-8', $response->getHeaderLine('Content-Type')); } - public function testCanOutputFileBodyFromBinary() + public function testCanOutputFileBodyFromBinary(): void { $response = new DownloadResponse('unit-test.txt', false); @@ -255,7 +255,7 @@ public function testCanOutputFileBodyFromBinary() $this->assertSame('test', $actual); } - public function testCanOutputFileBodyFromFile() + public function testCanOutputFileBodyFromFile(): void { $response = new DownloadResponse('unit-test.php', false); @@ -269,7 +269,7 @@ public function testCanOutputFileBodyFromFile() $this->assertSame(file_get_contents(__FILE__), $actual); } - public function testThrowExceptionWhenNoSetDownloadSource() + public function testThrowExceptionWhenNoSetDownloadSource(): void { $response = new DownloadResponse('unit-test.php', false); @@ -277,13 +277,13 @@ public function testThrowExceptionWhenNoSetDownloadSource() $response->sendBody(); } - public function testGetReason() + public function testGetReason(): void { $response = new DownloadResponse('unit-test.php', false); $this->assertSame('OK', $response->getReasonPhrase()); } - public function testPretendOutput() + public function testPretendOutput(): void { $response = new DownloadResponse('unit-test.php', false); $response->pretend(true); @@ -302,7 +302,7 @@ public function testPretendOutput() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testRealOutput() + public function testRealOutput(): void { $response = new DownloadResponse('unit-test.php', false); $response->pretend(false); diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index c9d2c0123acf..6c9983effb84 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -27,14 +27,14 @@ protected function setUp(): void $_FILES = []; } - public function testAllReturnsArrayWithNoFiles() + public function testAllReturnsArrayWithNoFiles(): void { $files = new FileCollection(); $this->assertSame([], $files->all()); } - public function testAllReturnsValidSingleFile() + public function testAllReturnsValidSingleFile(): void { $_FILES = [ 'userfile' => [ @@ -57,7 +57,7 @@ public function testAllReturnsValidSingleFile() $this->assertSame(124, $file->getSize()); } - public function testAllReturnsValidMultipleFilesSameName() + public function testAllReturnsValidMultipleFilesSameName(): void { $_FILES = [ 'userfile' => [ @@ -99,7 +99,7 @@ public function testAllReturnsValidMultipleFilesSameName() $this->assertSame(124, $file->getSize()); } - public function testAllReturnsValidMultipleFilesDifferentName() + public function testAllReturnsValidMultipleFilesDifferentName(): void { $_FILES = [ 'userfile1' => [ @@ -144,7 +144,7 @@ public function testAllReturnsValidMultipleFilesDifferentName() $this->assertSame(248, $file->getSize()); } - public function testExtensionGuessing() + public function testExtensionGuessing(): void { $_FILES = [ 'userfile1' => [ @@ -218,7 +218,7 @@ public function testExtensionGuessing() $this->assertSame('zip', $file->guessExtension()); } - public function testAllReturnsValidSingleFileNestedName() + public function testAllReturnsValidSingleFileNestedName(): void { $_FILES = [ 'userfile' => [ @@ -263,7 +263,7 @@ public function testAllReturnsValidSingleFileNestedName() $this->assertSame(124, $file->getSize()); } - public function testHasFileWithSingleFile() + public function testHasFileWithSingleFile(): void { $_FILES = [ 'userfile' => [ @@ -281,7 +281,7 @@ public function testHasFileWithSingleFile() $this->assertFalse($collection->hasFile('foo')); } - public function testHasFileWithMultipleFilesWithDifferentNames() + public function testHasFileWithMultipleFilesWithDifferentNames(): void { $_FILES = [ 'userfile1' => [ @@ -306,7 +306,7 @@ public function testHasFileWithMultipleFilesWithDifferentNames() $this->assertTrue($collection->hasFile('userfile2')); } - public function testHasFileWithSingleFileNestedName() + public function testHasFileWithSingleFileNestedName(): void { $_FILES = [ 'userfile' => [ @@ -341,7 +341,7 @@ public function testHasFileWithSingleFileNestedName() $this->assertTrue($collection->hasFile('userfile.foo.bar')); } - public function testErrorString() + public function testErrorString(): void { $_FILES = [ 'userfile' => [ @@ -361,7 +361,7 @@ public function testErrorString() $this->assertSame($expected, $file->getErrorString()); } - public function testErrorStringWithUnknownError() + public function testErrorStringWithUnknownError(): void { $_FILES = [ 'userfile' => [ @@ -381,7 +381,7 @@ public function testErrorStringWithUnknownError() $this->assertSame($expected, $file->getErrorString()); } - public function testErrorStringWithNoError() + public function testErrorStringWithNoError(): void { $_FILES = [ 'userfile' => [ @@ -400,7 +400,7 @@ public function testErrorStringWithNoError() $this->assertSame($expected, $file->getErrorString()); } - public function testError() + public function testError(): void { $_FILES = [ 'userfile' => [ @@ -418,7 +418,7 @@ public function testError() $this->assertSame(UPLOAD_ERR_INI_SIZE, $file->getError()); } - public function testErrorWithUnknownError() + public function testErrorWithUnknownError(): void { $_FILES = [ 'userfile' => [ @@ -435,7 +435,7 @@ public function testErrorWithUnknownError() $this->assertSame(0, $file->getError()); } - public function testErrorWithNoError() + public function testErrorWithNoError(): void { $_FILES = [ 'userfile' => [ @@ -453,7 +453,7 @@ public function testErrorWithNoError() $this->assertSame(UPLOAD_ERR_OK, $file->getError()); } - public function testFileReturnsValidSingleFile() + public function testFileReturnsValidSingleFile(): void { $_FILES = [ 'userfile' => [ @@ -473,7 +473,7 @@ public function testFileReturnsValidSingleFile() $this->assertSame(124, $file->getSize()); } - public function testFileNoExistSingleFile() + public function testFileNoExistSingleFile(): void { $_FILES = [ 'userfile' => [ @@ -490,7 +490,7 @@ public function testFileNoExistSingleFile() $this->AssertNull($file); } - public function testFileReturnValidMultipleFiles() + public function testFileReturnValidMultipleFiles(): void { $_FILES = [ 'userfile' => [ @@ -533,7 +533,7 @@ public function testFileReturnValidMultipleFiles() $this->assertSame(248, $file2->getSize()); } - public function testFileWithMultipleFilesNestedName() + public function testFileWithMultipleFilesNestedName(): void { $_FILES = [ 'my-form' => [ @@ -599,7 +599,7 @@ public function testFileWithMultipleFilesNestedName() $this->assertSame(243, $file2->getSize()); } - public function testDoesntHaveFile() + public function testDoesntHaveFile(): void { $_FILES = [ 'my-form' => [ @@ -652,7 +652,7 @@ public function testDoesntHaveFile() $this->assertNull($collection->getFile('my-form.detailz.avatars.0')); } - public function testGetFileMultipleHasNoFile() + public function testGetFileMultipleHasNoFile(): void { $_FILES = [ 'userfile' => [ @@ -683,7 +683,7 @@ public function testGetFileMultipleHasNoFile() $this->assertNull($files); } - public function testGetFileMultipleReturnValidDotNotationSyntax() + public function testGetFileMultipleReturnValidDotNotationSyntax(): void { $_FILES = [ 'my-form' => [ @@ -751,7 +751,7 @@ public function testGetFileMultipleReturnValidDotNotationSyntax() $this->assertSame(243, $files[1]->getSize()); } - public function testGetFileMultipleReturnInvalidDotNotationSyntax() + public function testGetFileMultipleReturnInvalidDotNotationSyntax(): void { $_FILES = [ 'my-form' => [ @@ -789,7 +789,7 @@ public function testGetFileMultipleReturnInvalidDotNotationSyntax() $this->assertNull($files); } - public function testGetFileMultipleReturnValidMultipleFiles() + public function testGetFileMultipleReturnValidMultipleFiles(): void { $_FILES = [ 'userfile' => [ @@ -834,7 +834,7 @@ public function testGetFileMultipleReturnValidMultipleFiles() $this->assertSame('text/csv', $files[1]->getClientMimeType()); } - public function testGetFileMultipleReturnInvalidSingleFile() + public function testGetFileMultipleReturnInvalidSingleFile(): void { $_FILES = [ 'userfile' => [ diff --git a/tests/system/HTTP/Files/FileMovingTest.php b/tests/system/HTTP/Files/FileMovingTest.php index 2362d64296b7..5ec79796e136 100644 --- a/tests/system/HTTP/Files/FileMovingTest.php +++ b/tests/system/HTTP/Files/FileMovingTest.php @@ -60,7 +60,7 @@ protected function tearDown(): void } } - public function testMove() + public function testMove(): void { $finalFilename = 'fileA'; $_FILES = [ @@ -100,7 +100,7 @@ public function testMove() $this->assertTrue($this->root->hasChild('destination/' . $finalFilename . '_1.txt')); } - public function testMoveOverwriting() + public function testMoveOverwriting(): void { $finalFilename = 'file_with_delimiters_underscore'; $_FILES = [ @@ -150,7 +150,7 @@ public function testMoveOverwriting() $this->assertFileExists($destination . '/' . $finalFilename . '.txt'); } - public function testMoved() + public function testMoved(): void { $finalFilename = 'fileA'; $_FILES = [ @@ -183,7 +183,7 @@ public function testMoved() $this->assertTrue($file->hasMoved()); } - public function testStore() + public function testStore(): void { $finalFilename = 'fileA'; $_FILES = [ @@ -215,7 +215,7 @@ public function testStore() $this->assertSame($destination . '/fileA.txt', $path); } - public function testAlreadyMoved() + public function testAlreadyMoved(): void { $finalFilename = 'fileA'; $_FILES = [ @@ -246,7 +246,7 @@ public function testAlreadyMoved() } } - public function testInvalidFile() + public function testInvalidFile(): void { $_FILES = [ 'userfile' => [ @@ -267,7 +267,7 @@ public function testInvalidFile() $file->move($destination, $file->getName(), false); } - public function testFailedMoveBecauseOfWarning() + public function testFailedMoveBecauseOfWarning(): void { $_FILES = [ 'userfile' => [ @@ -293,7 +293,7 @@ public function testFailedMoveBecauseOfWarning() $file->move($destination, $file->getName(), false); } - public function testFailedMoveBecauseOfFalseReturned() + public function testFailedMoveBecauseOfFalseReturned(): void { $_FILES = [ 'userfile1' => [ @@ -363,7 +363,7 @@ function move_uploaded_file($filename, $destination, ?bool $setReturnValue = nul return $return; } -function rrmdir($src) +function rrmdir($src): void { $dir = opendir($src); diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index 43ccf91b3c26..34d6190ef2a6 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -22,7 +22,7 @@ */ final class HeaderTest extends CIUnitTestCase { - public function testHeaderStoresBasics() + public function testHeaderStoresBasics(): void { $name = 'foo'; $value = 'bar'; @@ -33,7 +33,7 @@ public function testHeaderStoresBasics() $this->assertSame($value, $header->getValue()); } - public function testHeaderStoresBasicsWithNull() + public function testHeaderStoresBasicsWithNull(): void { $name = 'foo'; $value = null; @@ -44,7 +44,7 @@ public function testHeaderStoresBasicsWithNull() $this->assertSame('', $header->getValue()); } - public function testHeaderStoresBasicWithInt() + public function testHeaderStoresBasicWithInt(): void { $name = 'foo'; $value = 123; @@ -55,7 +55,7 @@ public function testHeaderStoresBasicWithInt() $this->assertSame((string) $value, $header->getValue()); } - public function testHeaderStoresBasicWithObject() + public function testHeaderStoresBasicWithObject(): void { $this->expectException(Error::class); $this->expectExceptionMessage('Object of class stdClass could not be converted to string'); @@ -66,7 +66,7 @@ public function testHeaderStoresBasicWithObject() new Header($name, $value); } - public function testHeaderStoresArrayValues() + public function testHeaderStoresArrayValues(): void { $name = 'foo'; $value = [ @@ -80,7 +80,7 @@ public function testHeaderStoresArrayValues() $this->assertSame($value, $header->getValue()); } - public function testHeaderStoresArrayKeyValue() + public function testHeaderStoresArrayKeyValue(): void { $name = 'foo'; $value = [ @@ -94,7 +94,7 @@ public function testHeaderStoresArrayKeyValue() $this->assertSame('key=val', $header->getValueLine()); } - public function testHeaderSetters() + public function testHeaderSetters(): void { $name = 'foo'; $value = [ @@ -114,7 +114,7 @@ public function testHeaderSetters() $this->assertSame($name . ': bar, 123', (string) $header); } - public function testHeaderAppendsValueSkippedForNull() + public function testHeaderAppendsValueSkippedForNull(): void { $name = 'foo'; $value = 'bar'; @@ -128,7 +128,7 @@ public function testHeaderAppendsValueSkippedForNull() $this->assertSame($expected, $header->getValue()); } - public function testHeaderConvertsSingleToArray() + public function testHeaderConvertsSingleToArray(): void { $name = 'foo'; $value = 'bar'; @@ -146,7 +146,7 @@ public function testHeaderConvertsSingleToArray() $this->assertSame($expected, $header->getValue()); } - public function testHeaderPrependsValueSkippedForNull() + public function testHeaderPrependsValueSkippedForNull(): void { $name = 'foo'; $value = 'bar'; @@ -160,7 +160,7 @@ public function testHeaderPrependsValueSkippedForNull() $this->assertSame($expected, $header->getValue()); } - public function testHeaderPrependsValue() + public function testHeaderPrependsValue(): void { $name = 'foo'; $value = 'bar'; @@ -178,7 +178,7 @@ public function testHeaderPrependsValue() $this->assertSame($expected, $header->getValue()); } - public function testHeaderLineSimple() + public function testHeaderLineSimple(): void { $name = 'foo'; $value = [ @@ -194,7 +194,7 @@ public function testHeaderLineSimple() $this->assertSame($expected, $header->getValueLine()); } - public function testHeaderSetValueWithNullWillMarkAsEmptyString() + public function testHeaderSetValueWithNullWillMarkAsEmptyString(): void { $name = 'foo'; $expected = ''; @@ -206,7 +206,7 @@ public function testHeaderSetValueWithNullWillMarkAsEmptyString() $this->assertSame($expected, $header->getValueLine()); } - public function testHeaderLineWithArrayValues() + public function testHeaderLineWithArrayValues(): void { $name = 'foo'; @@ -220,7 +220,7 @@ public function testHeaderLineWithArrayValues() $this->assertSame($expected, $header->getValueLine()); } - public function testHeaderToStringShowsEntireHeader() + public function testHeaderToStringShowsEntireHeader(): void { $name = 'foo'; diff --git a/tests/system/HTTP/IncomingRequestDetectingTest.php b/tests/system/HTTP/IncomingRequestDetectingTest.php index cd220cbe0987..481821dd922b 100644 --- a/tests/system/HTTP/IncomingRequestDetectingTest.php +++ b/tests/system/HTTP/IncomingRequestDetectingTest.php @@ -36,7 +36,7 @@ protected function setUp(): void $this->request = new IncomingRequest(new App(), new URI($origin), null, new UserAgent()); } - public function testPathDefault() + public function testPathDefault(): void { // /index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot'; @@ -46,7 +46,7 @@ public function testPathDefault() $this->assertSame($expected, $this->request->detectPath()); } - public function testPathDefaultEmpty() + public function testPathDefaultEmpty(): void { // / $_SERVER['REQUEST_URI'] = '/'; @@ -56,7 +56,7 @@ public function testPathDefaultEmpty() $this->assertSame($expected, $this->request->detectPath()); } - public function testPathRequestURI() + public function testPathRequestURI(): void { // /index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot'; @@ -66,7 +66,7 @@ public function testPathRequestURI() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURINested() + public function testPathRequestURINested(): void { // I'm not sure but this is a case of Apache config making such SERVER // values? @@ -84,7 +84,7 @@ public function testPathRequestURINested() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURISubfolder() + public function testPathRequestURISubfolder(): void { // /ci/index.php/popcorn/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/ci/index.php/popcorn/woot'; @@ -94,7 +94,7 @@ public function testPathRequestURISubfolder() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURINoIndex() + public function testPathRequestURINoIndex(): void { // /sub/example $_SERVER['REQUEST_URI'] = '/sub/example'; @@ -104,7 +104,7 @@ public function testPathRequestURINoIndex() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURINginx() + public function testPathRequestURINginx(): void { // /ci/index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot?code=good'; @@ -114,7 +114,7 @@ public function testPathRequestURINginx() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURINginxRedirecting() + public function testPathRequestURINginxRedirecting(): void { // /?/ci/index.php/woot $_SERVER['REQUEST_URI'] = '/?/ci/woot'; @@ -124,7 +124,7 @@ public function testPathRequestURINginxRedirecting() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathRequestURISuppressed() + public function testPathRequestURISuppressed(): void { // /woot?code=good#pos $_SERVER['REQUEST_URI'] = '/woot'; @@ -134,7 +134,7 @@ public function testPathRequestURISuppressed() $this->assertSame($expected, $this->request->detectPath('REQUEST_URI')); } - public function testPathQueryString() + public function testPathQueryString(): void { // /index.php?/ci/woot $_SERVER['REQUEST_URI'] = '/index.php?/ci/woot'; @@ -145,7 +145,7 @@ public function testPathQueryString() $this->assertSame($expected, $this->request->detectPath('QUERY_STRING')); } - public function testPathQueryStringWithQueryString() + public function testPathQueryStringWithQueryString(): void { // /index.php?/ci/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php?/ci/woot?code=good'; @@ -156,7 +156,7 @@ public function testPathQueryStringWithQueryString() $this->assertSame($expected, $this->request->detectPath('QUERY_STRING')); } - public function testPathQueryStringEmpty() + public function testPathQueryStringEmpty(): void { // /index.php? $_SERVER['REQUEST_URI'] = '/index.php?'; @@ -167,7 +167,7 @@ public function testPathQueryStringEmpty() $this->assertSame($expected, $this->request->detectPath('QUERY_STRING')); } - public function testPathPathInfo() + public function testPathPathInfo(): void { // /index.php/woot?code=good#pos $this->request->setGlobal('server', [ @@ -180,7 +180,7 @@ public function testPathPathInfo() $this->assertSame($expected, $this->request->detectPath('PATH_INFO')); } - public function testPathPathInfoGlobal() + public function testPathPathInfoGlobal(): void { // /index.php/woot?code=good#pos $this->request->setGlobal('server', [ diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index b4ab3606ed8b..b8015fab933e 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $_POST = $_GET = $_SERVER = $_REQUEST = $_ENV = $_COOKIE = $_SESSION = []; } - public function testCanGrabRequestVars() + public function testCanGrabRequestVars(): void { $_REQUEST['TEST'] = 5; @@ -47,7 +47,7 @@ public function testCanGrabRequestVars() $this->assertNull($this->request->getVar('TESTY')); } - public function testCanGrabGetVars() + public function testCanGrabGetVars(): void { $_GET['TEST'] = 5; @@ -55,7 +55,7 @@ public function testCanGrabGetVars() $this->assertNull($this->request->getGet('TESTY')); } - public function testCanGrabPostVars() + public function testCanGrabPostVars(): void { $_POST['TEST'] = 5; @@ -63,7 +63,7 @@ public function testCanGrabPostVars() $this->assertNull($this->request->getPost('TESTY')); } - public function testCanGrabPostBeforeGet() + public function testCanGrabPostBeforeGet(): void { $_POST['TEST'] = 5; $_GET['TEST'] = 3; @@ -72,12 +72,12 @@ public function testCanGrabPostBeforeGet() $this->assertSame('3', $this->request->getGetPost('TEST')); } - public function testNoOldInput() + public function testNoOldInput(): void { $this->assertNull($this->request->getOldInput('name')); } - public function testCanGetOldInput() + public function testCanGetOldInput(): void { $_SESSION['_ci_old_input'] = [ 'get' => ['one' => 'two'], @@ -88,7 +88,7 @@ public function testCanGetOldInput() $this->assertSame('two', $this->request->getOldInput('one')); } - public function testCanGetOldInputDotted() + public function testCanGetOldInputDotted(): void { $_SESSION['_ci_old_input'] = [ 'get' => ['apple' => ['name' => 'two']], @@ -99,7 +99,7 @@ public function testCanGetOldInputDotted() $this->assertSame('two', $this->request->getOldInput('apple.name')); } - public function testMissingOldInput() + public function testMissingOldInput(): void { $_SESSION['_ci_old_input'] = [ 'get' => ['apple' => ['name' => 'two']], @@ -112,7 +112,7 @@ public function testMissingOldInput() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/1492 */ - public function testCanGetOldInputArrayWithSESSION() + public function testCanGetOldInputArrayWithSESSION(): void { $_SESSION['_ci_old_input'] = [ 'get' => ['apple' => ['name' => 'two']], @@ -129,7 +129,7 @@ public function testCanGetOldInputArrayWithSESSION() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testCanGetOldInputArrayWithSessionService() + public function testCanGetOldInputArrayWithSessionService(): void { $locations = [ 'AB' => 'Alberta', @@ -142,7 +142,7 @@ public function testCanGetOldInputArrayWithSessionService() $this->assertSame($locations, $this->request->getOldInput('location')); } - public function testCanGrabServerVars() + public function testCanGrabServerVars(): void { $server = $this->getPrivateProperty($this->request, 'globals'); $server['server']['TEST'] = 5; @@ -152,7 +152,7 @@ public function testCanGrabServerVars() $this->assertNull($this->request->getServer('TESTY')); } - public function testCanGrabEnvVars() + public function testCanGrabEnvVars(): void { $server = $this->getPrivateProperty($this->request, 'globals'); $server['env']['TEST'] = 5; @@ -162,7 +162,7 @@ public function testCanGrabEnvVars() $this->assertNull($this->request->getEnv('TESTY')); } - public function testCanGrabCookieVars() + public function testCanGrabCookieVars(): void { $_COOKIE['TEST'] = 5; @@ -170,7 +170,7 @@ public function testCanGrabCookieVars() $this->assertNull($this->request->getCookie('TESTY')); } - public function testStoresDefaultLocale() + public function testStoresDefaultLocale(): void { $config = new App(); @@ -178,7 +178,7 @@ public function testStoresDefaultLocale() $this->assertSame($config->defaultLocale, $this->request->getLocale()); } - public function testSetLocaleSaves() + public function testSetLocaleSaves(): void { $config = new App(); $config->supportedLocales = ['en', 'es']; @@ -191,7 +191,7 @@ public function testSetLocaleSaves() $this->assertSame('en', $request->getLocale()); } - public function testSetBadLocale() + public function testSetBadLocale(): void { $config = new App(); $config->supportedLocales = ['en', 'es']; @@ -207,7 +207,7 @@ public function testSetBadLocale() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/2774 */ - public function testNegotiatesLocale() + public function testNegotiatesLocale(): void { $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR; q=1.0, en; q=0.5'; @@ -222,7 +222,7 @@ public function testNegotiatesLocale() $this->assertSame('fr', $request->getLocale()); } - public function testNegotiatesLocaleOnlyBroad() + public function testNegotiatesLocaleOnlyBroad(): void { $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr; q=1.0, en; q=0.5'; @@ -241,7 +241,7 @@ public function testNegotiatesLocaleOnlyBroad() // that is up to the NegotiateTest. These are only to make sure that the requests // flow through to the negotiator - public function testNegotiatesNot() + public function testNegotiatesNot(): void { $this->request->setHeader('Accept-Charset', 'iso-8859-5, unicode-1-1;q=0.8'); @@ -249,7 +249,7 @@ public function testNegotiatesNot() $this->request->negotiate('something bogus', ['iso-8859-5', 'unicode-1-1']); } - public function testNegotiatesCharset() + public function testNegotiatesCharset(): void { // $_SERVER['HTTP_ACCEPT_CHARSET'] = 'iso-8859-5, unicode-1-1;q=0.8'; $this->request->setHeader('Accept-Charset', 'iso-8859-5, unicode-1-1;q=0.8'); @@ -260,7 +260,7 @@ public function testNegotiatesCharset() ); } - public function testNegotiatesMedia() + public function testNegotiatesMedia(): void { $this->request->setHeader('Accept', 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c'); $this->assertSame( @@ -269,19 +269,19 @@ public function testNegotiatesMedia() ); } - public function testNegotiatesEncoding() + public function testNegotiatesEncoding(): void { $this->request->setHeader('Accept-Encoding', 'gzip;q=1.0, identity; q=0.4, compress;q=0.5'); $this->assertSame('gzip', $this->request->negotiate('encoding', ['gzip', 'compress'])); } - public function testNegotiatesLanguage() + public function testNegotiatesLanguage(): void { $this->request->setHeader('Accept-Language', 'da, en-gb;q=0.8, en;q=0.7'); $this->assertSame('en', $this->request->negotiate('language', ['en', 'da'])); } - public function testCanGrabGetRawJSON() + public function testCanGrabGetRawJSON(): void { $json = '{"code":1, "message":"ok"}'; @@ -295,7 +295,7 @@ public function testCanGrabGetRawJSON() $this->assertSame($expected, $request->getJSON(true)); } - public function testCanGetAVariableFromJson() + public function testCanGetAVariableFromJson(): void { $jsonObj = [ 'foo' => 'bar', @@ -327,7 +327,7 @@ public function testCanGetAVariableFromJson() $this->assertNull($request->getJsonVar('null')); } - public function testGetJsonVarAsArray() + public function testGetJsonVarAsArray(): void { $jsonObj = [ 'baz' => [ @@ -358,7 +358,7 @@ public function testGetJsonVarAsArray() $this->assertNull($jsonVar['null']); } - public function testGetJsonVarCanFilter() + public function testGetJsonVarCanFilter(): void { $json = json_encode(['foo' => 'bar']); @@ -370,7 +370,7 @@ public function testGetJsonVarCanFilter() $this->assertFalse($request->getJsonVar('foo', false, FILTER_VALIDATE_INT)); } - public function testGetJsonVarCanFilterArray() + public function testGetJsonVarCanFilterArray(): void { $json = json_encode([ 'string' => 'hello123world', @@ -423,7 +423,7 @@ public function testGetJsonVarCanFilterArray() ); } - public function testGetVarWorksWithJson() + public function testGetVarWorksWithJson(): void { $json = json_encode(['foo' => 'bar', 'fizz' => 'buzz']); @@ -448,7 +448,7 @@ public function testGetVarWorksWithJson() $this->assertSame('buzz', $all->fizz); } - public function testGetVarWorksWithJsonAndGetParams() + public function testGetVarWorksWithJsonAndGetParams(): void { $config = new App(); $config->baseURL = 'http://example.com/'; @@ -480,7 +480,7 @@ public function testGetVarWorksWithJsonAndGetParams() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/5391 */ - public function testGetJsonVarReturnsNullFromNullBody() + public function testGetJsonVarReturnsNullFromNullBody(): void { $config = new App(); $config->baseURL = 'http://example.com/'; @@ -490,7 +490,7 @@ public function testGetJsonVarReturnsNullFromNullBody() $this->assertNull($request->getJsonVar('myKey')); } - public function testgetJSONReturnsNullFromNullBody() + public function testgetJSONReturnsNullFromNullBody(): void { $config = new App(); $config->baseURL = 'http://example.com/'; @@ -500,7 +500,7 @@ public function testgetJSONReturnsNullFromNullBody() $this->assertNull($request->getJSON()); } - public function testCanGrabGetRawInput() + public function testCanGrabGetRawInput(): void { $rawstring = 'username=admin001&role=administrator&usepass=0'; @@ -606,7 +606,7 @@ public function provideRawInputVarChecks(): iterable * @param mixed $filter * @param mixed $flag */ - public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $flag) + public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, $flag): void { $config = new App(); $config->baseURL = 'http://example.com/'; @@ -619,7 +619,7 @@ public function testCanGrabGetRawInputVar($rawstring, $var, $expected, $filter, /** * @dataProvider provideIsHTTPMethods */ - public function testIsHTTPMethodLowerCase(string $value) + public function testIsHTTPMethodLowerCase(string $value): void { $request = $this->request->withMethod($value); @@ -642,14 +642,14 @@ public function provideIsHTTPMethods(): iterable /** * @dataProvider provideIsHTTPMethods */ - public function testIsHTTPMethodUpperCase(string $value) + public function testIsHTTPMethodUpperCase(string $value): void { $request = $this->request->withMethod($value); $this->assertTrue($request->is($value)); } - public function testIsInvalidValue() + public function testIsInvalidValue(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Unknown type: invalid'); @@ -659,50 +659,50 @@ public function testIsInvalidValue() $request->is('invalid'); } - public function testIsJson() + public function testIsJson(): void { $request = $this->request->setHeader('Content-Type', 'application/json'); $this->assertTrue($request->is('json')); } - public function testIsWithAjax() + public function testIsWithAjax(): void { $request = $this->request->setHeader('X-Requested-With', 'XMLHttpRequest'); $this->assertTrue($request->is('ajax')); } - public function testIsCLI() + public function testIsCLI(): void { $this->assertFalse($this->request->isCLI()); } - public function testIsAJAX() + public function testIsAJAX(): void { $this->request->appendHeader('X-Requested-With', 'XMLHttpRequest'); $this->assertTrue($this->request->isAJAX()); } - public function testIsSecure() + public function testIsSecure(): void { $_SERVER['HTTPS'] = 'on'; $this->assertTrue($this->request->isSecure()); } - public function testIsSecureFrontEnd() + public function testIsSecureFrontEnd(): void { $this->request->appendHeader('Front-End-Https', 'on'); $this->assertTrue($this->request->isSecure()); } - public function testIsSecureForwarded() + public function testIsSecureForwarded(): void { $this->request->appendHeader('X-Forwarded-Proto', 'https'); $this->assertTrue($this->request->isSecure()); } - public function testUserAgent() + public function testUserAgent(): void { $_SERVER['HTTP_USER_AGENT'] = 'Mozilla'; @@ -712,7 +712,7 @@ public function testUserAgent() $this->assertSame('Mozilla', $request->getUserAgent()->__toString()); } - public function testFileCollectionFactory() + public function testFileCollectionFactory(): void { $_FILES = [ 'userfile' => [ @@ -734,7 +734,7 @@ public function testFileCollectionFactory() $this->assertSame(124, $file->getSize()); } - public function testGetFileMultiple() + public function testGetFileMultiple(): void { $_FILES = [ 'userfile' => [ @@ -766,7 +766,7 @@ public function testGetFileMultiple() $this->assertSame(125, $gotit[1]->getSize()); } - public function testGetFile() + public function testGetFile(): void { $_FILES = [ 'userfile' => [ @@ -782,7 +782,7 @@ public function testGetFile() $this->assertSame(124, $gotit->getSize()); } - public function testSpoofing() + public function testSpoofing(): void { $this->request->setMethod('WINK'); $this->assertSame('wink', $this->request->getMethod()); @@ -791,7 +791,7 @@ public function testSpoofing() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/2839 */ - public function testGetPostEmpty() + public function testGetPostEmpty(): void { $_POST['TEST'] = '5'; $_GET['TEST'] = '3'; @@ -799,19 +799,19 @@ public function testGetPostEmpty() $this->assertSame($_GET, $this->request->getGetPost()); } - public function testPostGetSecondStream() + public function testPostGetSecondStream(): void { $_GET['get'] = '3'; $this->assertSame($_GET, $this->request->getPostGet()); } - public function testGetPostSecondStream() + public function testGetPostSecondStream(): void { $_POST['post'] = '5'; $this->assertSame($_POST, $this->request->getGetPost()); } - public function testGetPostSecondStreams() + public function testGetPostSecondStreams(): void { $_GET['get'] = '3'; $_POST['post'] = '5'; @@ -819,7 +819,7 @@ public function testGetPostSecondStreams() $this->assertSame(array_merge($_POST, $_GET), $this->request->getGetPost()); } - public function testWithFalseBody() + public function testWithFalseBody(): void { // Use `false` here to simulate file_get_contents returning a false value $request = new IncomingRequest(new App(), new URI(), false, new UserAgent()); @@ -831,7 +831,7 @@ public function testWithFalseBody() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/3020 */ - public function testGetPostIndexNotExists() + public function testGetPostIndexNotExists(): void { $_POST['TEST'] = 5; $_GET['TEST'] = 3; @@ -859,7 +859,7 @@ public function providePathChecks(): iterable * @param mixed $path * @param mixed $detectPath */ - public function testExtensionPHP($path, $detectPath) + public function testExtensionPHP($path, $detectPath): void { $config = new App(); $config->baseURL = 'http://example.com/'; @@ -870,7 +870,7 @@ public function testExtensionPHP($path, $detectPath) $this->assertSame($detectPath, $request->detectPath()); } - public function testGetPath() + public function testGetPath(): void { $_SERVER['REQUEST_URI'] = '/index.php/fruits/banana'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -880,7 +880,7 @@ public function testGetPath() $this->assertSame('fruits/banana', $request->getPath()); } - public function testGetPathIsRelative() + public function testGetPathIsRelative(): void { $_SERVER['REQUEST_URI'] = '/sub/folder/index.php/fruits/banana'; $_SERVER['SCRIPT_NAME'] = '/sub/folder/index.php'; @@ -890,7 +890,7 @@ public function testGetPathIsRelative() $this->assertSame('fruits/banana', $request->getPath()); } - public function testGetPathStoresDetectedValue() + public function testGetPathStoresDetectedValue(): void { $_SERVER['REQUEST_URI'] = '/fruits/banana'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -902,7 +902,7 @@ public function testGetPathStoresDetectedValue() $this->assertSame('fruits/banana', $request->getPath()); } - public function testGetPathIsRediscovered() + public function testGetPathIsRediscovered(): void { $_SERVER['REQUEST_URI'] = '/fruits/banana'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -915,7 +915,7 @@ public function testGetPathIsRediscovered() $this->assertSame('candy/snickers', $request->getPath()); } - public function testSetPath() + public function testSetPath(): void { $request = new IncomingRequest(new App(), new URI(), null, new UserAgent()); $this->assertSame('', $request->getPath()); @@ -924,7 +924,7 @@ public function testSetPath() $this->assertSame('foobar', $request->getPath()); } - public function testSetPathUpdatesURI() + public function testSetPathUpdatesURI(): void { $request = new IncomingRequest(new App(), new URI(), null, new UserAgent()); @@ -933,7 +933,7 @@ public function testSetPathUpdatesURI() $this->assertSame('apples', $request->getUri()->getPath()); } - public function testGetIPAddressNormal() + public function testGetIPAddressNormal(): void { $expected = '123.123.123.123'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -946,7 +946,7 @@ public function testGetIPAddressNormal() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxy() + public function testGetIPAddressThruProxy(): void { $expected = '123.123.123.123'; $_SERVER['HTTP_X_FORWARDED_FOR'] = $expected; @@ -964,7 +964,7 @@ public function testGetIPAddressThruProxy() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyIPv6() + public function testGetIPAddressThruProxyIPv6(): void { $expected = '123.123.123.123'; $_SERVER['HTTP_X_FORWARDED_FOR'] = $expected; @@ -981,7 +981,7 @@ public function testGetIPAddressThruProxyIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyInvalidIPAddress() + public function testGetIPAddressThruProxyInvalidIPAddress(): void { $_SERVER['HTTP_X_FORWARDED_FOR'] = '123.456.23.123'; $expected = '10.0.1.200'; @@ -999,7 +999,7 @@ public function testGetIPAddressThruProxyInvalidIPAddress() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyInvalidIPAddressIPv6() + public function testGetIPAddressThruProxyInvalidIPAddressIPv6(): void { $_SERVER['HTTP_X_FORWARDED_FOR'] = '2001:xyz::1'; $expected = '2001:db8::2:1'; @@ -1016,7 +1016,7 @@ public function testGetIPAddressThruProxyInvalidIPAddressIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyNotWhitelisted() + public function testGetIPAddressThruProxyNotWhitelisted(): void { $expected = '10.10.1.200'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -1034,7 +1034,7 @@ public function testGetIPAddressThruProxyNotWhitelisted() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyNotWhitelistedIPv6() + public function testGetIPAddressThruProxyNotWhitelistedIPv6(): void { $expected = '2001:db8::2:2'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -1051,7 +1051,7 @@ public function testGetIPAddressThruProxyNotWhitelistedIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxySubnet() + public function testGetIPAddressThruProxySubnet(): void { $expected = '123.123.123.123'; $_SERVER['HTTP_X_FORWARDED_FOR'] = $expected; @@ -1066,7 +1066,7 @@ public function testGetIPAddressThruProxySubnet() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxySubnetIPv6() + public function testGetIPAddressThruProxySubnetIPv6(): void { $expected = '123.123.123.123'; $_SERVER['HTTP_X_FORWARDED_FOR'] = $expected; @@ -1081,7 +1081,7 @@ public function testGetIPAddressThruProxySubnetIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyOutOfSubnet() + public function testGetIPAddressThruProxyOutOfSubnet(): void { $expected = '192.168.5.21'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -1096,7 +1096,7 @@ public function testGetIPAddressThruProxyOutOfSubnet() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyOutOfSubnetIPv6() + public function testGetIPAddressThruProxyOutOfSubnetIPv6(): void { $expected = '2001:db8:1235:ffff:ffff:ffff:ffff:ffff'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -1111,7 +1111,7 @@ public function testGetIPAddressThruProxyOutOfSubnetIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyBothIPv4AndIPv6() + public function testGetIPAddressThruProxyBothIPv4AndIPv6(): void { $expected = '2001:db8:1235:ffff:ffff:ffff:ffff:ffff'; $_SERVER['REMOTE_ADDR'] = $expected; @@ -1129,7 +1129,7 @@ public function testGetIPAddressThruProxyBothIPv4AndIPv6() $this->assertSame($expected, $this->request->getIPAddress()); } - public function testGetIPAddressThruProxyInvalidConfigString() + public function testGetIPAddressThruProxyInvalidConfigString(): void { $this->expectException(TypeError::class); @@ -1141,7 +1141,7 @@ public function testGetIPAddressThruProxyInvalidConfigString() $this->request->getIPAddress(); } - public function testGetIPAddressThruProxyInvalidConfigArray() + public function testGetIPAddressThruProxyInvalidConfigArray(): void { $this->expectException(ConfigException::class); $this->expectExceptionMessage( diff --git a/tests/system/HTTP/MessageTest.php b/tests/system/HTTP/MessageTest.php index 86e870d3b073..67768aa7ea2c 100644 --- a/tests/system/HTTP/MessageTest.php +++ b/tests/system/HTTP/MessageTest.php @@ -32,7 +32,7 @@ protected function setUp(): void // We can only test the headers retrieved from $_SERVER // This test might fail under apache. - public function testHeadersRetrievesHeaders() + public function testHeadersRetrievesHeaders(): void { $this->message->setHeader('Host', 'daisyduke.com'); $this->message->setHeader('Referer', 'RoscoePekoTrain.com'); @@ -46,7 +46,7 @@ public function testHeadersRetrievesHeaders() $this->assertSame('RoscoePekoTrain.com', $headers['Referer']->getValue()); } - public function testCanGrabSingleHeader() + public function testCanGrabSingleHeader(): void { $this->message->setHeader('Host', 'daisyduke.com'); @@ -56,7 +56,7 @@ public function testCanGrabSingleHeader() $this->assertSame('daisyduke.com', $header->getValue()); } - public function testCaseInsensitiveheader() + public function testCaseInsensitiveheader(): void { $this->message->setHeader('Host', 'daisyduke.com'); @@ -64,7 +64,7 @@ public function testCaseInsensitiveheader() $this->assertSame('daisyduke.com', $this->message->header('HOST')->getValue()); } - public function testCanSetHeaders() + public function testCanSetHeaders(): void { $this->message->setHeader('first', 'kiss'); $this->message->setHeader('second', ['black', 'book']); @@ -73,7 +73,7 @@ public function testCanSetHeaders() $this->assertSame(['black', 'book'], $this->message->header('Second')->getValue()); } - public function testSetHeaderOverwritesPrevious() + public function testSetHeaderOverwritesPrevious(): void { $this->message->setHeader('Pragma', 'cache'); $this->message->setHeader('Pragma', 'no-cache'); @@ -81,7 +81,7 @@ public function testSetHeaderOverwritesPrevious() $this->assertSame('no-cache', $this->message->header('Pragma')->getValue()); } - public function testHeaderLineIsReadable() + public function testHeaderLineIsReadable(): void { $this->message->setHeader('Accept', ['json', 'html']); $this->message->setHeader('Host', 'daisyduke.com'); @@ -90,7 +90,7 @@ public function testHeaderLineIsReadable() $this->assertSame('daisyduke.com', $this->message->header('Host')->getValueLine()); } - public function testCanRemoveHeader() + public function testCanRemoveHeader(): void { $this->message->setHeader('Host', 'daisyduke.com'); @@ -99,7 +99,7 @@ public function testCanRemoveHeader() $this->assertNull($this->message->header('host')); } - public function testCanAppendHeader() + public function testCanAppendHeader(): void { $this->message->setHeader('accept', ['json', 'html']); @@ -108,7 +108,7 @@ public function testCanAppendHeader() $this->assertSame(['json', 'html', 'xml'], $this->message->header('accept')->getValue()); } - public function testCanPrependHeader() + public function testCanPrependHeader(): void { $this->message->setHeader('accept', ['json', 'html']); @@ -117,27 +117,27 @@ public function testCanPrependHeader() $this->assertSame(['xml', 'json', 'html'], $this->message->header('accept')->getValue()); } - public function testSetProtocolWorks() + public function testSetProtocolWorks(): void { $this->message->setProtocolVersion('1.1'); $this->assertSame('1.1', $this->message->getProtocolVersion()); } - public function testSetProtocolWorksWithNonNumericVersion() + public function testSetProtocolWorksWithNonNumericVersion(): void { $this->message->setProtocolVersion('HTTP/1.1'); $this->assertSame('1.1', $this->message->getProtocolVersion()); } - public function testSetProtocolThrowsExceptionWithInvalidProtocol() + public function testSetProtocolThrowsExceptionWithInvalidProtocol(): void { $this->expectException(HTTPException::class); $this->message->setProtocolVersion('1.2'); } - public function testBodyBasics() + public function testBodyBasics(): void { $body = 'a strange little fellow.'; @@ -146,7 +146,7 @@ public function testBodyBasics() $this->assertSame($body, $this->message->getBody()); } - public function testAppendBody() + public function testAppendBody(): void { $this->message->setBody('moo'); @@ -155,14 +155,14 @@ public function testAppendBody() $this->assertSame("moo\n", $this->message->getBody()); } - public function testSetHeaderReplacingHeader() + public function testSetHeaderReplacingHeader(): void { $this->message->setHeader('Accept', 'json'); $this->assertSame('json', $this->message->getHeaderLine('Accept')); } - public function testSetHeaderDuplicateSettings() + public function testSetHeaderDuplicateSettings(): void { $this->message->setHeader('Accept', 'json'); $this->message->setHeader('Accept', 'xml'); @@ -170,7 +170,7 @@ public function testSetHeaderDuplicateSettings() $this->assertSame('xml', $this->message->getHeaderLine('Accept')); } - public function testSetHeaderDuplicateSettingsInsensitive() + public function testSetHeaderDuplicateSettingsInsensitive(): void { $this->message->setHeader('Accept', 'json'); $this->message->setHeader('accept', 'xml'); @@ -178,7 +178,7 @@ public function testSetHeaderDuplicateSettingsInsensitive() $this->assertSame('xml', $this->message->getHeaderLine('Accept')); } - public function testSetHeaderArrayValues() + public function testSetHeaderArrayValues(): void { $this->message->setHeader('Accept', ['json', 'html', 'xml']); @@ -209,7 +209,7 @@ public function provideArrayHeaderValue(): iterable * * @param mixed $arrayHeaderValue */ - public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHeaderValue) + public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); $this->message->setHeader('Accept', 'xml'); @@ -222,7 +222,7 @@ public function testSetHeaderWithExistingArrayValuesAppendStringValue($arrayHead * * @param mixed $arrayHeaderValue */ - public function testSetHeaderWithExistingArrayValuesAppendArrayValue($arrayHeaderValue) + public function testSetHeaderWithExistingArrayValuesAppendArrayValue($arrayHeaderValue): void { $this->message->setHeader('Accept', $arrayHeaderValue); $this->message->setHeader('Accept', ['xml']); @@ -230,7 +230,7 @@ public function testSetHeaderWithExistingArrayValuesAppendArrayValue($arrayHeade $this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept')); } - public function testSetHeaderWithExistingArrayValuesAppendNullValue() + public function testSetHeaderWithExistingArrayValuesAppendNullValue(): void { $this->message->setHeader('Accept', ['json', 'html', 'xml']); $this->message->setHeader('Accept', null); @@ -238,7 +238,7 @@ public function testSetHeaderWithExistingArrayValuesAppendNullValue() $this->assertSame('json, html, xml', $this->message->getHeaderLine('Accept')); } - public function testPopulateHeadersWithoutContentType() + public function testPopulateHeadersWithoutContentType(): void { $original = $_SERVER; $originalEnv = getenv('CONTENT_TYPE'); @@ -255,7 +255,7 @@ public function testPopulateHeadersWithoutContentType() $_SERVER = $original; // restore so code coverage doesn't break } - public function testPopulateHeadersWithoutHTTP() + public function testPopulateHeadersWithoutHTTP(): void { // fail path, if argument doesn't have the HTTP_* $original = $_SERVER; @@ -272,7 +272,7 @@ public function testPopulateHeadersWithoutHTTP() $_SERVER = $original; // restore so code coverage doesn't break } - public function testPopulateHeadersKeyNotExists() + public function testPopulateHeadersKeyNotExists(): void { // Success path, if array key is not exists, assign empty string to it's value $original = $_SERVER; @@ -288,7 +288,7 @@ public function testPopulateHeadersKeyNotExists() $_SERVER = $original; // restore so code coverage doesn't break } - public function testPopulateHeaders() + public function testPopulateHeaders(): void { // success path $original = $_SERVER; diff --git a/tests/system/HTTP/NegotiateTest.php b/tests/system/HTTP/NegotiateTest.php index 547b50ca8039..4323e80c2b42 100644 --- a/tests/system/HTTP/NegotiateTest.php +++ b/tests/system/HTTP/NegotiateTest.php @@ -33,7 +33,7 @@ protected function setUp(): void $this->negotiate = new Negotiate($this->request); } - public function testNegotiateMediaFindsHighestMatch() + public function testNegotiateMediaFindsHighestMatch(): void { $this->request->setHeader('Accept', 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c'); $this->negotiate->setRequest($this->request); @@ -47,7 +47,7 @@ public function testNegotiateMediaFindsHighestMatch() $this->assertSame('text/md', $this->negotiate->media(['text/md'])); } - public function testParseHeaderDeterminesCorrectPrecedence() + public function testParseHeaderDeterminesCorrectPrecedence(): void { $header = $this->negotiate->parseHeader('text/*, text/plain, text/plain;format=flowed, */*'); @@ -57,14 +57,14 @@ public function testParseHeaderDeterminesCorrectPrecedence() $this->assertSame('*/*', $header[3]['value']); } - public function testNegotiateMediaReturnsSupportedMatchWhenAsterisksInAvailable() + public function testNegotiateMediaReturnsSupportedMatchWhenAsterisksInAvailable(): void { $this->request->setHeader('Accept', 'image/*, text/*'); $this->assertSame('text/plain', $this->negotiate->media(['text/plain'])); } - public function testNegotiateMediaRecognizesMediaTypes() + public function testNegotiateMediaRecognizesMediaTypes(): void { // Image has a higher specificity, but is the wrong type... $this->request->setHeader('Accept', 'text/*, image/jpeg'); @@ -72,7 +72,7 @@ public function testNegotiateMediaRecognizesMediaTypes() $this->assertSame('text/plain', $this->negotiate->media(['text/plain'])); } - public function testNegotiateMediaSupportsStrictMatching() + public function testNegotiateMediaSupportsStrictMatching(): void { // Image has a higher specificity, but is the wrong type... $this->request->setHeader('Accept', 'text/md, image/jpeg'); @@ -81,7 +81,7 @@ public function testNegotiateMediaSupportsStrictMatching() $this->assertSame('', $this->negotiate->media(['text/plain'], true)); } - public function testAcceptCharsetMatchesBasics() + public function testAcceptCharsetMatchesBasics(): void { $this->request->setHeader('Accept-Charset', 'iso-8859-5, unicode-1-1;q=0.8'); @@ -92,12 +92,12 @@ public function testAcceptCharsetMatchesBasics() $this->assertSame('utf-8', $this->negotiate->charset(['iso-8859', 'unicode-1-2'])); } - public function testNegotiateEncodingReturnsFirstIfNoAcceptHeaderExists() + public function testNegotiateEncodingReturnsFirstIfNoAcceptHeaderExists(): void { $this->assertSame('compress', $this->negotiate->encoding(['compress', 'gzip'])); } - public function testNegotiatesEncodingBasics() + public function testNegotiatesEncodingBasics(): void { $this->request->setHeader('Accept-Encoding', 'gzip;q=1.0, identity; q=0.4, compress;q=0.5'); @@ -106,7 +106,7 @@ public function testNegotiatesEncodingBasics() $this->assertSame('identity', $this->negotiate->encoding()); } - public function testAcceptLanguageBasics() + public function testAcceptLanguageBasics(): void { $this->request->setHeader('Accept-Language', 'da, en-gb;q=0.8, en;q=0.7'); @@ -118,47 +118,47 @@ public function testAcceptLanguageBasics() /** * @see https://github.com/codeigniter4/CodeIgniter4/issues/2774 */ - public function testAcceptLanguageMatchesBroadly() + public function testAcceptLanguageMatchesBroadly(): void { $this->request->setHeader('Accept-Language', 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7'); $this->assertSame('fr', $this->negotiate->language(['fr', 'en'])); } - public function testBestMatchEmpty() + public function testBestMatchEmpty(): void { $this->expectException(HTTPException::class); $this->negotiate->media([]); } - public function testBestMatchNoHeader() + public function testBestMatchNoHeader(): void { $this->request->setHeader('Accept', ''); $this->assertSame('', $this->negotiate->media(['apple', 'banana'], true)); $this->assertSame('apple/mac', $this->negotiate->media(['apple/mac', 'banana/yellow'], false)); } - public function testBestMatchNotAcceptable() + public function testBestMatchNotAcceptable(): void { $this->request->setHeader('Accept', 'popcorn/cheddar'); $this->assertSame('apple/mac', $this->negotiate->media(['apple/mac', 'banana/yellow'], false)); $this->assertSame('banana/yellow', $this->negotiate->media(['banana/yellow', 'apple/mac'], false)); } - public function testBestMatchFirstSupported() + public function testBestMatchFirstSupported(): void { $this->request->setHeader('Accept', 'popcorn/cheddar, */*'); $this->assertSame('apple/mac', $this->negotiate->media(['apple/mac', 'banana/yellow'], false)); } - public function testBestMatchLowQuality() + public function testBestMatchLowQuality(): void { $this->request->setHeader('Accept', 'popcorn/cheddar;q=0, apple/mac, */*'); $this->assertSame('apple/mac', $this->negotiate->media(['apple/mac', 'popcorn/cheddar'], false)); $this->assertSame('apple/mac', $this->negotiate->media(['popcorn/cheddar', 'apple/mac'], false)); } - public function testBestMatchOnlyLowQuality() + public function testBestMatchOnlyLowQuality(): void { $this->request->setHeader('Accept', 'popcorn/cheddar;q=0'); // the first supported should be returned, since nothing will make us happy @@ -166,7 +166,7 @@ public function testBestMatchOnlyLowQuality() $this->assertSame('popcorn/cheddar', $this->negotiate->media(['popcorn/cheddar', 'apple/mac'], false)); } - public function testParameterMatching() + public function testParameterMatching(): void { $this->request->setHeader('Accept', 'popcorn/cheddar;a=0;b=1'); $this->assertSame('popcorn/cheddar;a=2', $this->negotiate->media(['popcorn/cheddar;a=2'], false)); diff --git a/tests/system/HTTP/OutgoingRequestTest.php b/tests/system/HTTP/OutgoingRequestTest.php index 8a6690772fa4..51b2bab6a3fe 100644 --- a/tests/system/HTTP/OutgoingRequestTest.php +++ b/tests/system/HTTP/OutgoingRequestTest.php @@ -20,7 +20,7 @@ */ final class OutgoingRequestTest extends CIUnitTestCase { - public function testCreateWithHeader() + public function testCreateWithHeader(): void { $uri = new URI('https://example.com/'); $headers = ['User-Agent' => 'Mozilla/5.0']; @@ -29,7 +29,7 @@ public function testCreateWithHeader() $this->assertSame('Mozilla/5.0', $request->header('User-Agent')->getValue()); } - public function testGetUri() + public function testGetUri(): void { $uri = new URI('https://example.com/'); $request = new OutgoingRequest('GET', $uri); @@ -37,7 +37,7 @@ public function testGetUri() $this->assertSame($uri, $request->getUri()); } - public function testWithMethod() + public function testWithMethod(): void { $uri = new URI('https://example.com/'); $request = new OutgoingRequest('GET', $uri); @@ -48,7 +48,7 @@ public function testWithMethod() $this->assertSame('POST', strtoupper($newRequest->getMethod())); } - public function testWithUri() + public function testWithUri(): void { $uri = new URI('https://example.com/'); $request = new OutgoingRequest('GET', $uri); @@ -65,7 +65,7 @@ public function testWithUri() * request. * https://www.php-fig.org/psr/psr-7/#32-psrhttpmessagerequestinterface */ - public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriContainsHost() + public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriContainsHost(): void { $uri = new URI(); $request = new OutgoingRequest('GET', $uri); @@ -82,7 +82,7 @@ public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriContainsHost( * request. * https://www.php-fig.org/psr/psr-7/#32-psrhttpmessagerequestinterface */ - public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriDoesNotContainsHost() + public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriDoesNotContainsHost(): void { $uri = new URI(); $request = new OutgoingRequest('GET', $uri); @@ -98,7 +98,7 @@ public function testWithUriPreserveHostHostHeaderIsMissingAndNewUriDoesNotContai * the Host header in the returned request. * https://www.php-fig.org/psr/psr-7/#32-psrhttpmessagerequestinterface */ - public function testWithUriPreserveHostHostHostIsNonEmpty() + public function testWithUriPreserveHostHostHostIsNonEmpty(): void { $uri = new URI('https://example.com/'); $request = new OutgoingRequest('GET', $uri); diff --git a/tests/system/HTTP/RedirectResponseTest.php b/tests/system/HTTP/RedirectResponseTest.php index 5f95b307d8cf..c775da828865 100644 --- a/tests/system/HTTP/RedirectResponseTest.php +++ b/tests/system/HTTP/RedirectResponseTest.php @@ -59,7 +59,7 @@ protected function setUp(): void Services::injectMock('request', $this->request); } - public function testRedirectToFullURI() + public function testRedirectToFullURI(): void { $response = new RedirectResponse(new App()); @@ -69,7 +69,7 @@ public function testRedirectToFullURI() $this->assertSame('http://example.com/foo', $response->getHeaderLine('Location')); } - public function testRedirectRoute() + public function testRedirectRoute(): void { $response = new RedirectResponse(new App()); @@ -88,7 +88,7 @@ public function testRedirectRoute() $this->assertSame('http://example.com/index.php/exampleRoute2', $response->getHeaderLine('Location')); } - public function testRedirectRouteBadNamedRoute() + public function testRedirectRouteBadNamedRoute(): void { $this->expectException(HTTPException::class); $this->expectExceptionMessage('The route for "differentRoute" cannot be found.'); @@ -100,7 +100,7 @@ public function testRedirectRouteBadNamedRoute() $response->route('differentRoute'); } - public function testRedirectRouteBadControllerMethod() + public function testRedirectRouteBadControllerMethod(): void { $this->expectException(HTTPException::class); $this->expectExceptionMessage('The route for "Bad::badMethod" cannot be found.'); @@ -112,7 +112,7 @@ public function testRedirectRouteBadControllerMethod() $response->route('Bad::badMethod'); } - public function testRedirectRelativeConvertsToFullURI() + public function testRedirectRelativeConvertsToFullURI(): void { $response = new RedirectResponse($this->config); @@ -126,7 +126,7 @@ public function testRedirectRelativeConvertsToFullURI() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testWithInput() + public function testWithInput(): void { $_SESSION = []; $_GET = ['foo' => 'bar']; @@ -146,7 +146,7 @@ public function testWithInput() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testWithValidationErrors() + public function testWithValidationErrors(): void { $_SESSION = []; @@ -166,7 +166,7 @@ public function testWithValidationErrors() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testWith() + public function testWith(): void { $_SESSION = []; @@ -182,7 +182,7 @@ public function testWith() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testRedirectBack() + public function testRedirectBack(): void { $_SERVER['HTTP_REFERER'] = 'http://somewhere.com'; $this->request = new MockIncomingRequest($this->config, new URI('http://somewhere.com'), null, new UserAgent()); @@ -198,7 +198,7 @@ public function testRedirectBack() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testRedirectBackMissing() + public function testRedirectBackMissing(): void { $_SESSION = []; @@ -215,7 +215,7 @@ public function testRedirectBackMissing() * * @see https://github.com/codeigniter4/CodeIgniter4/issues/2119 */ - public function testRedirectRouteBaseUrl() + public function testRedirectRouteBaseUrl(): void { $config = new App(); $config->baseURL = 'http://example.com/test/'; @@ -236,7 +236,7 @@ public function testRedirectRouteBaseUrl() Factories::reset('config'); } - public function testWithCookies() + public function testWithCookies(): void { $_SESSION = []; @@ -254,7 +254,7 @@ public function testWithCookies() * @runInSeparateProcess * @preserveGlobalState disabled */ - public function testWithCookiesWithEmptyCookies() + public function testWithCookiesWithEmptyCookies(): void { $_SESSION = []; @@ -264,7 +264,7 @@ public function testWithCookiesWithEmptyCookies() $this->assertEmpty($response->getCookies()); } - public function testWithHeaders() + public function testWithHeaders(): void { $_SESSION = []; @@ -282,7 +282,7 @@ public function testWithHeaders() } } - public function testWithHeadersWithEmptyHeaders() + public function testWithHeadersWithEmptyHeaders(): void { $_SESSION = []; diff --git a/tests/system/HTTP/RequestTest.php b/tests/system/HTTP/RequestTest.php index ab19f05adfac..3eaea59ed1c2 100644 --- a/tests/system/HTTP/RequestTest.php +++ b/tests/system/HTTP/RequestTest.php @@ -35,7 +35,7 @@ protected function setUp(): void $_GET = []; } - public function testFetchGlobalsSingleValue() + public function testFetchGlobalsSingleValue(): void { $_POST['foo'] = 'bar'; $_GET['bar'] = 'baz'; @@ -44,12 +44,12 @@ public function testFetchGlobalsSingleValue() $this->assertSame('baz', $this->request->fetchGlobal('get', 'bar')); } - public function testFetchGlobalsReturnsNullWhenNotFound() + public function testFetchGlobalsReturnsNullWhenNotFound(): void { $this->assertNull($this->request->fetchGlobal('post', 'foo')); } - public function testFetchGlobalsFiltersValues() + public function testFetchGlobalsFiltersValues(): void { $this->request->setGlobal('post', [ 'foo' => 'bar'; $this->assertSame($expected, script_tag($target)); } - public function testScriptTagWithoutProtocol() + public function testScriptTagWithoutProtocol(): void { $target = 'js/mystyles.js'; $expected = ''; $this->assertSame($expected, script_tag($target)); } - public function testScriptTagWithIndexpage() + public function testScriptTagWithIndexpage(): void { $target = 'js/mystyles.js'; $expected = ''; $this->assertSame($expected, script_tag($target, true)); } - public function testScriptTagWithSrc() + public function testScriptTagWithSrc(): void { $target = ['src' => 'http://site.com/js/mystyles.js']; $expected = ''; $this->assertSame($expected, script_tag($target)); } - public function testScriptTagWithSrcWithoutProtocol() + public function testScriptTagWithSrcWithoutProtocol(): void { $target = ['src' => 'js/mystyles.js']; $expected = ''; $this->assertSame($expected, script_tag($target)); } - public function testScriptTagWithSrcAndAttributes() + public function testScriptTagWithSrcAndAttributes(): void { $target = ['src' => 'js/mystyles.js', 'charset' => 'UTF-8', 'defer' => '', 'async' => null]; $expected = ''; $this->assertSame($expected, script_tag($target)); } - public function testScriptTagWithCsp() + public function testScriptTagWithCsp(): void { // Reset CSP object $this->resetServices(); @@ -338,20 +338,20 @@ public function testScriptTagWithCsp() * This test has probably no real-world value but may help detecting * a change in the default behaviour. */ - public function testScriptTagWithoutAnyArg() + public function testScriptTagWithoutAnyArg(): void { $expected = ''; $this->assertSame($expected, script_tag()); } - public function testLinkTag() + public function testLinkTag(): void { $target = 'css/mystyles.css'; $expected = ''; $this->assertSame($expected, link_tag($target)); } - public function testLinkTagXHTML() + public function testLinkTagXHTML(): void { $doctypes = config('DocTypes'); $default = $doctypes->html5; @@ -365,7 +365,7 @@ public function testLinkTagXHTML() $doctypes->html5 = $default; } - public function testLinkTagMedia() + public function testLinkTagMedia(): void { $target = 'https://styles.com/css/mystyles.css'; $tag = link_tag($target, 'stylesheet', 'text/css', '', 'print'); @@ -374,7 +374,7 @@ public function testLinkTagMedia() $this->assertSame($expected, $tag); } - public function testLinkTagTitle() + public function testLinkTagTitle(): void { $tag = link_tag('default.css', 'stylesheet', 'text/css', 'Default Style'); @@ -382,7 +382,7 @@ public function testLinkTagTitle() $this->assertSame($expected, $tag); } - public function testLinkTagFavicon() + public function testLinkTagFavicon(): void { $tag = link_tag('favicon.ico', 'shortcut icon', 'image/ico'); @@ -390,7 +390,7 @@ public function testLinkTagFavicon() $this->assertSame($expected, $tag); } - public function testLinkTagRss() + public function testLinkTagRss(): void { $tag = link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed'); @@ -398,7 +398,7 @@ public function testLinkTagRss() $this->assertSame($expected, $tag); } - public function testLinkTagAlternate() + public function testLinkTagAlternate(): void { $tag = link_tag( 'http://sp.example.com/', @@ -412,7 +412,7 @@ public function testLinkTagAlternate() $this->assertSame($expected, $tag); } - public function testLinkTagArrayAlternate() + public function testLinkTagArrayAlternate(): void { $tag = link_tag([ 'href' => 'http://sp.example.com/', @@ -424,7 +424,7 @@ public function testLinkTagArrayAlternate() $this->assertSame($expected, $tag); } - public function testLinkTagCanonical() + public function testLinkTagCanonical(): void { $tag = link_tag('http://www.example.com/', 'canonical'); @@ -432,7 +432,7 @@ public function testLinkTagCanonical() $this->assertSame($expected, $tag); } - public function testLinkTagArray() + public function testLinkTagArray(): void { $parms = [ 'href' => 'css/mystyles.css', @@ -442,7 +442,7 @@ public function testLinkTagArray() $this->assertSame($expected, link_tag($parms)); } - public function testLinkTagArrayHreflang() + public function testLinkTagArrayHreflang(): void { $tag = link_tag([ 'href' => 'https://example.com/en', @@ -454,26 +454,26 @@ public function testLinkTagArrayHreflang() $this->assertSame($expected, $tag); } - public function testDocType() + public function testDocType(): void { $target = 'html4-strict'; $expected = ''; $this->assertSame($expected, doctype($target)); } - public function testDocTypeDefault() + public function testDocTypeDefault(): void { $expected = ''; $this->assertSame($expected, doctype()); } - public function testDocTypeInvalid() + public function testDocTypeInvalid(): void { $target = 'good-guess'; $this->assertEmpty(doctype($target)); } - public function testVideo() + public function testVideo(): void { $expected = <<<'EOH'