From 0dc1fcae1587f6ecb659d7e48965b318c150133e Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 23 Aug 2026 19:59:23 +0800 Subject: [PATCH] refactor: fix phpstan errors in `Result` --- system/Database/BaseResult.php | 143 +---------- system/Database/MySQLi/Connection.php | 2 +- system/Database/MySQLi/Result.php | 40 +-- system/Database/OCI8/Result.php | 33 +-- system/Database/Postgre/Result.php | 39 +-- system/Database/ResultInterface.php | 30 ++- system/Database/SQLSRV/Result.php | 38 +-- system/Database/SQLite3/Result.php | 35 +-- system/Test/Mock/MockResult.php | 35 +-- system/View/Table.php | 2 +- tests/system/Database/BaseResultTest.php | 4 +- tests/system/View/DBResultDummy.php | 2 +- utils/phpstan-baseline/loader.neon | 2 +- .../method.childParameterType.neon | 7 +- .../missingType.iterableValue.neon | 242 +----------------- 15 files changed, 43 insertions(+), 611 deletions(-) diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index 1b8fcdbd0cf8..5855eb064c86 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -25,42 +25,32 @@ abstract class BaseResult implements ResultInterface { /** - * Connection ID - * * @var TConnection */ public $connID; /** - * Result ID - * * @var false|TResult */ public $resultID; /** - * Result Array - * * @var list */ public $resultArray = []; /** - * Result Object - * * @var list */ public $resultObject = []; /** - * Custom Result Object - * - * @var array + * @var array> */ public $customResultObject = []; /** - * Current Row index + * Current row index * * @var int */ @@ -74,15 +64,11 @@ abstract class BaseResult implements ResultInterface protected $numRows; /** - * Row data - * - * @var array|null + * @var array|null */ public $rowData; /** - * Constructor - * * @param TConnection $connID * @param TResult $resultID */ @@ -92,13 +78,6 @@ public function __construct(&$connID, &$resultID) $this->resultID = $resultID; } - /** - * Retrieve the results of the query. Typically an array of - * individual data rows, which can be either an 'array', an - * 'object', or a custom class name. - * - * @param string $type The row type. Either 'array', 'object', or a class name to use - */ public function getResult(string $type = 'object'): array { if ($type === 'array') { @@ -112,13 +91,6 @@ public function getResult(string $type = 'object'): array return $this->getCustomResultObject($type); } - /** - * Returns the results as an array of custom objects. - * - * @param class-string $className - * - * @return array - */ public function getCustomResultObject(string $className) { if (isset($this->customResultObject[$className])) { @@ -165,11 +137,6 @@ public function getCustomResultObject(string $className) return $this->customResultObject[$className]; } - /** - * Returns the results as an array of arrays. - * - * If no results, an empty array is returned. - */ public function getResultArray(): array { if ($this->resultArray !== []) { @@ -202,13 +169,6 @@ public function getResultArray(): array return $this->resultArray; } - /** - * Returns the results as an array of objects. - * - * If no results, an empty array is returned. - * - * @return list - */ public function getResultObject(): array { if ($this->resultObject !== []) { @@ -245,19 +205,6 @@ public function getResultObject(): array return $this->resultObject; } - /** - * Wrapper object to return a row as either an array, an object, or - * a custom class. - * - * If the row doesn't exist, returns null. - * - * @template T of object - * - * @param int|string $n The index of the results to return, or column name. - * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. - * - * @return ($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))) - */ public function getRow($n = 0, string $type = 'object') { // $n is a column name. @@ -286,18 +233,6 @@ public function getRow($n = 0, string $type = 'object') return $this->getCustomRowObject($n, $type); } - /** - * Returns a row as a custom class instance. - * - * If the row doesn't exist, returns null. - * - * @template T of object - * - * @param int $n The index of the results to return. - * @param class-string $className - * - * @return T|null - */ public function getCustomRowObject(int $n, string $className) { if (! isset($this->customResultObject[$className])) { @@ -315,13 +250,6 @@ public function getCustomRowObject(int $n, string $className) return $this->customResultObject[$className][$this->currentRow] ?? null; } - /** - * Returns a single row from the results as an array. - * - * If row doesn't exist, returns null. - * - * @return array|null - */ public function getRowArray(int $n = 0) { $result = $this->getResultArray(); @@ -336,13 +264,6 @@ public function getRowArray(int $n = 0) return $result[$this->currentRow] ?? null; } - /** - * Returns a single row from the results as an object. - * - * If row doesn't exist, returns null. - * - * @return object|stdClass|null - */ public function getRowObject(int $n = 0) { $result = $this->getResultObject(); @@ -357,14 +278,6 @@ public function getRowObject(int $n = 0) return $result[$this->currentRow] ?? null; } - /** - * Assigns an item into a particular column slot. - * - * @param array|string $key - * @param array|object|stdClass|null $value - * - * @return void - */ public function setRow($key, $value = null) { // We cache the row data for subsequent uses @@ -385,9 +298,6 @@ public function setRow($key, $value = null) } } - /** - * Returns the "first" row of the current results. - */ public function getFirstRow(string $type = 'object') { $result = $this->getResult($type); @@ -395,9 +305,6 @@ public function getFirstRow(string $type = 'object') return ($result === []) ? null : $result[0]; } - /** - * Returns the "last" row of the current results. - */ public function getLastRow(string $type = 'object') { $result = $this->getResult($type); @@ -405,9 +312,6 @@ public function getLastRow(string $type = 'object') return ($result === []) ? null : $result[count($result) - 1]; } - /** - * Returns the "next" row of the current results. - */ public function getNextRow(string $type = 'object') { $result = $this->getResult($type); @@ -418,9 +322,6 @@ public function getNextRow(string $type = 'object') return isset($result[$this->currentRow + 1]) ? $result[++$this->currentRow] : null; } - /** - * Returns the "previous" row of the current results. - */ public function getPreviousRow(string $type = 'object') { $result = $this->getResult($type); @@ -435,11 +336,6 @@ public function getPreviousRow(string $type = 'object') return $result[$this->currentRow] ?? null; } - /** - * Returns an unbuffered row and move the pointer to the next row. - * - * @return array|object|null - */ public function getUnbufferedRow(string $type = 'object') { if ($type === 'array') { @@ -478,43 +374,12 @@ private function isValidResultId(): bool return is_resource($this->resultID) || is_object($this->resultID); } - /** - * Gets the number of fields in the result set. - */ - abstract public function getFieldCount(): int; - - /** - * Generates an array of column names in the result set. - */ - abstract public function getFieldNames(): array; - - /** - * Generates an array of objects representing field meta-data. - */ - abstract public function getFieldData(): array; - - /** - * Frees the current result. - * - * @return void - */ - abstract public function freeResult(); - - /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @return bool - */ - abstract public function dataSeek(int $n = 0); - /** * Returns the result set as an array. * * Overridden by driver classes. * - * @return array|false|null + * @return array|false|null */ abstract protected function fetchAssoc(); diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 5a6daa5a692e..29cb80b168c5 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -481,7 +481,7 @@ protected function _indexData(string $table): array $type = 'PRIMARY'; } elseif ($index['Index_type'] === 'FULLTEXT') { $type = 'FULLTEXT'; - } elseif ($index['Non_unique']) { + } elseif ((bool) $index['Non_unique']) { $type = $index['Index_type'] === 'SPATIAL' ? 'SPATIAL' : 'INDEX'; } else { $type = 'UNIQUE'; diff --git a/system/Database/MySQLi/Result.php b/system/Database/MySQLi/Result.php index 05d07bb69078..956a4e0a705c 100644 --- a/system/Database/MySQLi/Result.php +++ b/system/Database/MySQLi/Result.php @@ -26,17 +26,11 @@ */ class Result extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return $this->resultID->field_count; } - /** - * Generates an array of column names in the result set. - */ public function getFieldNames(): array { $fieldNames = []; @@ -49,9 +43,6 @@ public function getFieldNames(): array return $fieldNames; } - /** - * Generates an array of objects representing field meta-data. - */ public function getFieldData(): array { static $dataTypes = [ @@ -103,11 +94,6 @@ public function getFieldData(): array return $retVal; } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { if (is_object($this->resultID)) { @@ -116,38 +102,17 @@ public function freeResult() } } - /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @return bool - */ public function dataSeek(int $n = 0) { return $this->resultID->data_seek($n); } - /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * - * @return array|false|null - */ protected function fetchAssoc() { return $this->resultID->fetch_assoc(); } - /** - * Returns the result set as an object. - * - * Overridden by child classes. - * - * @return Entity|false|object|stdClass - */ - protected function fetchObject(string $className = 'stdClass') + protected function fetchObject(string $className = stdClass::class) { if (is_subclass_of($className, Entity::class)) { $data = $this->fetchAssoc(); @@ -158,9 +123,6 @@ protected function fetchObject(string $className = 'stdClass') return $this->resultID->fetch_object($className); } - /** - * Returns the number of rows in the resultID (i.e., mysqli_result object) - */ public function getNumRows(): int { if (! is_int($this->numRows)) { diff --git a/system/Database/OCI8/Result.php b/system/Database/OCI8/Result.php index 1049847b7af0..6882bff00f45 100644 --- a/system/Database/OCI8/Result.php +++ b/system/Database/OCI8/Result.php @@ -24,25 +24,16 @@ */ class Result extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return oci_num_fields($this->resultID); } - /** - * Generates an array of column names in the result set. - */ public function getFieldNames(): array { return array_map(fn ($fieldIndex): false|string => oci_field_name($this->resultID, $fieldIndex), range(1, $this->getFieldCount())); } - /** - * Generates an array of objects representing field meta-data. - */ public function getFieldData(): array { return array_map(fn ($fieldIndex) => (object) [ @@ -52,11 +43,6 @@ public function getFieldData(): array ], range(1, $this->getFieldCount())); } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { if (is_resource($this->resultID)) { @@ -66,10 +52,6 @@ public function freeResult() } /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * * @return false */ public function dataSeek(int $n = 0) @@ -79,25 +61,14 @@ public function dataSeek(int $n = 0) } /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * - * @return array|false + * @return array|false */ protected function fetchAssoc() { return oci_fetch_assoc($this->resultID); } - /** - * Returns the result set as an object. - * - * Overridden by child classes. - * - * @return Entity|false|object|stdClass - */ - protected function fetchObject(string $className = 'stdClass') + protected function fetchObject(string $className = stdClass::class) { $row = oci_fetch_object($this->resultID); diff --git a/system/Database/Postgre/Result.php b/system/Database/Postgre/Result.php index fee628296173..d071ff27f6f5 100644 --- a/system/Database/Postgre/Result.php +++ b/system/Database/Postgre/Result.php @@ -26,17 +26,11 @@ */ class Result extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return pg_num_fields($this->resultID); } - /** - * Generates an array of column names in the result set. - */ public function getFieldNames(): array { $fieldNames = []; @@ -48,9 +42,6 @@ public function getFieldNames(): array return $fieldNames; } - /** - * Generates an array of objects representing field meta-data. - */ public function getFieldData(): array { $retVal = []; @@ -69,11 +60,6 @@ public function getFieldData(): array return $retVal; } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { if ($this->resultID !== false) { @@ -82,38 +68,20 @@ public function freeResult() } } - /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @return bool - */ public function dataSeek(int $n = 0) { return pg_result_seek($this->resultID, $n); } /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * - * @return array|false + * @return array|false */ protected function fetchAssoc() { return pg_fetch_assoc($this->resultID); } - /** - * Returns the result set as an object. - * - * Overridden by child classes. - * - * @return Entity|false|object|stdClass - */ - protected function fetchObject(string $className = 'stdClass') + protected function fetchObject(string $className = stdClass::class) { if (is_subclass_of($className, Entity::class)) { $data = $this->fetchAssoc(); @@ -124,9 +92,6 @@ protected function fetchObject(string $className = 'stdClass') return pg_fetch_object($this->resultID, null, $className); } - /** - * Returns the number of rows in the resultID (i.e., PostgreSQL query result resource) - */ public function getNumRows(): int { if (! is_int($this->numRows)) { diff --git a/system/Database/ResultInterface.php b/system/Database/ResultInterface.php index 0157a1df8149..48de9f01c3d4 100644 --- a/system/Database/ResultInterface.php +++ b/system/Database/ResultInterface.php @@ -27,6 +27,8 @@ interface ResultInterface * 'object', or a custom class name. * * @param string $type The row type. Either 'array', 'object', or a class name to use + * + * @return ($type is 'array' ? list> : ($type is 'object' ? list : list)) */ public function getResult(string $type = 'object'): array; @@ -35,7 +37,7 @@ public function getResult(string $type = 'object'): array; * * @param string $className The name of the class to use. * - * @return array + * @return list */ public function getCustomResultObject(string $className); @@ -43,6 +45,8 @@ public function getCustomResultObject(string $className); * Returns the results as an array of arrays. * * If no results, an empty array is returned. + * + * @return list> */ public function getResultArray(): array; @@ -50,6 +54,8 @@ public function getResultArray(): array; * Returns the results as an array of objects. * * If no results, an empty array is returned. + * + * @return list */ public function getResultObject(): array; @@ -64,7 +70,7 @@ public function getResultObject(): array; * @param int|string $n The index of the results to return, or column name. * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. * - * @return ($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))) + * @return ($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))) */ public function getRow($n = 0, string $type = 'object'); @@ -87,7 +93,7 @@ public function getCustomRowObject(int $n, string $className); * * If row doesn't exist, returns null. * - * @return array|null + * @return array|null */ public function getRowArray(int $n = 0); @@ -103,8 +109,8 @@ public function getRowObject(int $n = 0); /** * Assigns an item into a particular column slot. * - * @param array|string $key - * @param array|object|stdClass|null $value + * @param array|string $key + * @param array|object|null $value * * @return void */ @@ -117,7 +123,7 @@ public function setRow($key, $value = null); * * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. * - * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) + * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) */ public function getFirstRow(string $type = 'object'); @@ -128,7 +134,7 @@ public function getFirstRow(string $type = 'object'); * * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. * - * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) + * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) */ public function getLastRow(string $type = 'object'); @@ -139,7 +145,7 @@ public function getLastRow(string $type = 'object'); * * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. * - * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) + * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) */ public function getNextRow(string $type = 'object'); @@ -150,7 +156,7 @@ public function getNextRow(string $type = 'object'); * * @param 'array'|'object'|class-string $type The type of result object. 'array', 'object' or class name. * - * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) + * @return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)) */ public function getPreviousRow(string $type = 'object'); @@ -162,7 +168,7 @@ public function getNumRows(): int; /** * Returns an unbuffered row and move the pointer to the next row. * - * @return array|object|null + * @return array|object|null */ public function getUnbufferedRow(string $type = 'object'); @@ -173,11 +179,15 @@ public function getFieldCount(): int; /** * Generates an array of column names in the result set. + * + * @return list */ public function getFieldNames(): array; /** * Generates an array of objects representing field meta-data. + * + * @return list */ public function getFieldData(): array; diff --git a/system/Database/SQLSRV/Result.php b/system/Database/SQLSRV/Result.php index 27e3ee1e5256..5a5f3beed997 100644 --- a/system/Database/SQLSRV/Result.php +++ b/system/Database/SQLSRV/Result.php @@ -24,17 +24,11 @@ */ class Result extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return @sqlsrv_num_fields($this->resultID); } - /** - * Generates an array of column names in the result set. - */ public function getFieldNames(): array { $fieldNames = []; @@ -46,9 +40,6 @@ public function getFieldNames(): array return $fieldNames; } - /** - * Generates an array of objects representing field meta-data. - */ public function getFieldData(): array { static $dataTypes = [ @@ -103,11 +94,6 @@ public function getFieldData(): array return $retVal; } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { if (is_resource($this->resultID)) { @@ -116,13 +102,6 @@ public function freeResult() } } - /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @return bool - */ public function dataSeek(int $n = 0) { if ($n > 0) { @@ -136,24 +115,12 @@ public function dataSeek(int $n = 0) return true; } - /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * - * @return array|false|null - */ protected function fetchAssoc() { return sqlsrv_fetch_array($this->resultID, SQLSRV_FETCH_ASSOC); } - /** - * Returns the result set as an object. - * - * @return Entity|false|object|stdClass - */ - protected function fetchObject(string $className = 'stdClass') + protected function fetchObject(string $className = stdClass::class) { if (is_subclass_of($className, Entity::class)) { $data = $this->fetchAssoc(); @@ -164,9 +131,6 @@ protected function fetchObject(string $className = 'stdClass') return sqlsrv_fetch_object($this->resultID, $className); } - /** - * Returns the number of rows in the resultID (i.e., SQLSRV query result resource) - */ public function getNumRows(): int { if (! is_int($this->numRows)) { diff --git a/system/Database/SQLite3/Result.php b/system/Database/SQLite3/Result.php index aa5abf28682a..a3c8556fccfe 100644 --- a/system/Database/SQLite3/Result.php +++ b/system/Database/SQLite3/Result.php @@ -28,17 +28,11 @@ */ class Result extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return $this->resultID->numColumns(); } - /** - * Generates an array of column names in the result set. - */ public function getFieldNames(): array { $fieldNames = []; @@ -50,9 +44,6 @@ public function getFieldNames(): array return $fieldNames; } - /** - * Generates an array of objects representing field meta-data. - */ public function getFieldData(): array { static $dataTypes = [ @@ -80,11 +71,6 @@ public function getFieldData(): array return $retVal; } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { if (is_object($this->resultID)) { @@ -94,12 +80,6 @@ public function freeResult() } /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @return bool - * * @throws DatabaseException */ public function dataSeek(int $n = 0) @@ -112,25 +92,14 @@ public function dataSeek(int $n = 0) } /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * - * @return array|false + * @return array|false */ protected function fetchAssoc() { return $this->resultID->fetchArray(SQLITE3_ASSOC); } - /** - * Returns the result set as an object. - * - * Overridden by child classes. - * - * @return Entity|false|object|stdClass - */ - protected function fetchObject(string $className = 'stdClass') + protected function fetchObject(string $className = stdClass::class) { // No native support for fetching rows as objects if (($row = $this->fetchAssoc()) === false) { diff --git a/system/Test/Mock/MockResult.php b/system/Test/Mock/MockResult.php index bc5cd8ac2054..28147af9cd9e 100644 --- a/system/Test/Mock/MockResult.php +++ b/system/Test/Mock/MockResult.php @@ -21,17 +21,12 @@ */ class MockResult extends BaseResult { - /** - * Gets the number of fields in the result set. - */ public function getFieldCount(): int { return 0; } /** - * Generates an array of column names in the result set. - * * @return array{} */ public function getFieldNames(): array @@ -40,8 +35,6 @@ public function getFieldNames(): array } /** - * Generates an array of objects representing field meta-data. - * * @return array{} */ public function getFieldData(): array @@ -49,34 +42,19 @@ public function getFieldData(): array return []; } - /** - * Frees the current result. - * - * @return void - */ public function freeResult() { } /** - * Moves the internal pointer to the desired offset. This is called - * internally before fetching results to make sure the result set - * starts at zero. - * - * @param int $n - * - * @return bool + * @return true */ - public function dataSeek($n = 0) + public function dataSeek(int $n = 0) { return true; } /** - * Returns the result set as an array. - * - * Overridden by driver classes. - * * @return array{} */ protected function fetchAssoc() @@ -85,20 +63,13 @@ protected function fetchAssoc() } /** - * Returns the result set as an object. - * - * @param class-string $className - * * @return object */ - protected function fetchObject($className = stdClass::class) + protected function fetchObject(string $className = stdClass::class) { return new $className(); } - /** - * Gets the number of fields in the result set. - */ public function getNumRows(): int { return 0; diff --git a/system/View/Table.php b/system/View/Table.php index ee6057811615..42ee5402adff 100644 --- a/system/View/Table.php +++ b/system/View/Table.php @@ -260,7 +260,7 @@ public function setSyncRowsWithHeading(bool $orderByKey) * * Ensures a standard associative array format for all cell data * - * @param array $args + * @param array $args * * @return array>|list> */ diff --git a/tests/system/Database/BaseResultTest.php b/tests/system/Database/BaseResultTest.php index 901faee6a565..aa14f54ec8fb 100644 --- a/tests/system/Database/BaseResultTest.php +++ b/tests/system/Database/BaseResultTest.php @@ -67,7 +67,7 @@ public function getFieldNames(): array } /** - * @return list + * @return list */ public function getFieldData(): array { @@ -84,7 +84,7 @@ public function dataSeek(int $n = 0): bool } /** - * @return false|list>|null + * @return array|false|null */ protected function fetchAssoc(): array|bool|null { diff --git a/tests/system/View/DBResultDummy.php b/tests/system/View/DBResultDummy.php index fb42f41b04b6..62ebb298b853 100644 --- a/tests/system/View/DBResultDummy.php +++ b/tests/system/View/DBResultDummy.php @@ -27,7 +27,7 @@ public function getFieldNames(): array } /** - * @return array> + * @return list> */ public function getResultArray(): array { diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index a5cf84a90e35..b3302ee9448e 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 703 errors +# total 654 errors includes: - argument.type.neon diff --git a/utils/phpstan-baseline/method.childParameterType.neon b/utils/phpstan-baseline/method.childParameterType.neon index aa135b562c3e..d237e221ebf5 100644 --- a/utils/phpstan-baseline/method.childParameterType.neon +++ b/utils/phpstan-baseline/method.childParameterType.neon @@ -1,4 +1,4 @@ -# total 6 errors +# total 5 errors parameters: ignoreErrors: @@ -7,11 +7,6 @@ parameters: count: 1 path: ../../system/Cookie/Cookie.php - - - message: '#^Parameter \#1 \$className \(class\-string\) of method CodeIgniter\\Database\\BaseResult\:\:getCustomResultObject\(\) should be contravariant with parameter \$className \(string\) of method CodeIgniter\\Database\\ResultInterface\\:\:getCustomResultObject\(\)$#' - count: 1 - path: ../../system/Database/BaseResult.php - - message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\Time\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTimeImmutable\:\:__unserialize\(\)$#' count: 1 diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index 1078edd6ed71..6777cc2472c3 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,4 +1,4 @@ -# total 518 errors +# total 470 errors parameters: ignoreErrors: @@ -442,91 +442,6 @@ parameters: count: 1 path: ../../system/Database/BasePreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getCustomResultObject\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getFirstRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getLastRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getNextRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getPreviousRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getResultArray\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getResult\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getRowArray\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:getUnbufferedRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:setRow\(\) has parameter \$key with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Method CodeIgniter\\Database\\BaseResult\:\:setRow\(\) has parameter \$value with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Property CodeIgniter\\Database\\BaseResult\:\:\$customResultObject type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - - - message: '#^Property CodeIgniter\\Database\\BaseResult\:\:\$rowData type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/BaseResult.php - - message: '#^Method CodeIgniter\\Database\\BaseUtils\:\:_backup\(\) has parameter \$prefs with no value type specified in iterable type array\.$#' count: 1 @@ -662,21 +577,6 @@ parameters: count: 1 path: ../../system/Database/MySQLi/PreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\MySQLi\\Result\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/MySQLi/Result.php - - - - message: '#^Method CodeIgniter\\Database\\MySQLi\\Result\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/MySQLi/Result.php - - - - message: '#^Method CodeIgniter\\Database\\MySQLi\\Result\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/MySQLi/Result.php - - message: '#^Method CodeIgniter\\Database\\MySQLi\\Utils\:\:_backup\(\) has parameter \$prefs with no value type specified in iterable type array\.$#' count: 1 @@ -707,21 +607,6 @@ parameters: count: 1 path: ../../system/Database/OCI8/PreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\OCI8\\Result\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/OCI8/Result.php - - - - message: '#^Method CodeIgniter\\Database\\OCI8\\Result\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/OCI8/Result.php - - - - message: '#^Method CodeIgniter\\Database\\OCI8\\Result\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/OCI8/Result.php - - message: '#^Method CodeIgniter\\Database\\OCI8\\Utils\:\:_backup\(\) has parameter \$prefs with no value type specified in iterable type array\.$#' count: 1 @@ -742,21 +627,6 @@ parameters: count: 1 path: ../../system/Database/Postgre/PreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\Postgre\\Result\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/Postgre/Result.php - - - - message: '#^Method CodeIgniter\\Database\\Postgre\\Result\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/Postgre/Result.php - - - - message: '#^Method CodeIgniter\\Database\\Postgre\\Result\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/Postgre/Result.php - - message: '#^Method CodeIgniter\\Database\\Postgre\\Utils\:\:_backup\(\) has parameter \$prefs with no value type specified in iterable type array\.$#' count: 1 @@ -787,81 +657,6 @@ parameters: count: 1 path: ../../system/Database/Query.php - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getCustomResultObject\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getFirstRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getLastRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getNextRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getPreviousRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getResultArray\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getResultObject\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getResult\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getRowArray\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:getUnbufferedRow\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:setRow\(\) has parameter \$key with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - - - message: '#^Method CodeIgniter\\Database\\ResultInterface\:\:setRow\(\) has parameter \$value with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/ResultInterface.php - - message: '#^Method CodeIgniter\\Database\\SQLSRV\\Connection\:\:__construct\(\) has parameter \$params with no value type specified in iterable type array\.$#' count: 1 @@ -887,21 +682,6 @@ parameters: count: 1 path: ../../system/Database/SQLSRV/PreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\SQLSRV\\Result\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLSRV/Result.php - - - - message: '#^Method CodeIgniter\\Database\\SQLSRV\\Result\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLSRV/Result.php - - - - message: '#^Method CodeIgniter\\Database\\SQLSRV\\Result\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLSRV/Result.php - - message: '#^Method CodeIgniter\\Database\\SQLSRV\\Utils\:\:_backup\(\) has parameter \$prefs with no value type specified in iterable type array\.$#' count: 1 @@ -917,21 +697,6 @@ parameters: count: 1 path: ../../system/Database/SQLite3/PreparedQuery.php - - - message: '#^Method CodeIgniter\\Database\\SQLite3\\Result\:\:fetchAssoc\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLite3/Result.php - - - - message: '#^Method CodeIgniter\\Database\\SQLite3\\Result\:\:getFieldData\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLite3/Result.php - - - - message: '#^Method CodeIgniter\\Database\\SQLite3\\Result\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Database/SQLite3/Result.php - - message: '#^Method CodeIgniter\\Database\\SQLite3\\Table\:\:addForeignKey\(\) has parameter \$foreignKeys with no value type specified in iterable type array\.$#' count: 1 @@ -2557,11 +2322,6 @@ parameters: count: 1 path: ../../tests/system/Throttle/ThrottleTest.php - - - message: '#^Method CodeIgniter\\View\\DBResultDummy\:\:getFieldNames\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/View/DBResultDummy.php - - message: '#^Method CodeIgniter\\View\\ParserTest\:\:provideEscHandling\(\) return type has no value type specified in iterable type iterable\.$#' count: 1