diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index 2f073fd3151c..6910aa98aea6 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -356,10 +356,10 @@ public function getRowObject(int $n = 0) /** * Assigns an item into a particular column slot. * - * @param mixed $key - * @param mixed $value + * @param array|string $key + * @param array|object|stdClass|null $value * - * @return mixed + * @return void */ public function setRow($key, $value = null) { @@ -507,7 +507,7 @@ abstract public function freeResult(); * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool */ abstract public function dataSeek(int $n = 0); @@ -516,7 +516,7 @@ abstract public function dataSeek(int $n = 0); * * Overridden by driver classes. * - * @return mixed + * @return array|false|null */ abstract protected function fetchAssoc(); diff --git a/system/Database/MySQLi/Result.php b/system/Database/MySQLi/Result.php index 358a400ca9fe..d41cc24d3216 100644 --- a/system/Database/MySQLi/Result.php +++ b/system/Database/MySQLi/Result.php @@ -117,7 +117,7 @@ public function freeResult() * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool */ public function dataSeek(int $n = 0) { @@ -129,7 +129,7 @@ public function dataSeek(int $n = 0) * * Overridden by driver classes. * - * @return mixed + * @return array|false|null */ protected function fetchAssoc() { diff --git a/system/Database/OCI8/Result.php b/system/Database/OCI8/Result.php index f345cb7bd73a..68f663bf828a 100644 --- a/system/Database/OCI8/Result.php +++ b/system/Database/OCI8/Result.php @@ -80,7 +80,7 @@ public function dataSeek(int $n = 0) * * Overridden by driver classes. * - * @return mixed + * @return array|false */ protected function fetchAssoc() { diff --git a/system/Database/Postgre/Result.php b/system/Database/Postgre/Result.php index e81250c660df..3617e2a399dc 100644 --- a/system/Database/Postgre/Result.php +++ b/system/Database/Postgre/Result.php @@ -83,7 +83,7 @@ public function freeResult() * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool */ public function dataSeek(int $n = 0) { @@ -95,7 +95,7 @@ public function dataSeek(int $n = 0) * * Overridden by driver classes. * - * @return mixed + * @return array|false */ protected function fetchAssoc() { diff --git a/system/Database/ResultInterface.php b/system/Database/ResultInterface.php index bb1a5d6b5b6d..9aa788aba307 100644 --- a/system/Database/ResultInterface.php +++ b/system/Database/ResultInterface.php @@ -11,6 +11,8 @@ namespace CodeIgniter\Database; +use stdClass; + /** * @template TConnection of object|resource * @template TResult of object|resource @@ -31,7 +33,7 @@ public function getResult(string $type = 'object'): array; * * @param string $className The name of the class to use. * - * @return mixed + * @return array */ public function getCustomResultObject(string $className); @@ -55,10 +57,11 @@ public function getResultObject(): array; * * If row doesn't exist, returns null. * - * @param mixed $n The index of the results to return + * @param int $n The index of the results to return * @param string $type The type of result object. 'array', 'object' or class name. * - * @return mixed + * @return array|object|stdClass|null + * @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null)) */ public function getRow($n = 0, string $type = 'object'); @@ -67,7 +70,7 @@ public function getRow($n = 0, string $type = 'object'); * * If row doesn't exists, returns null. * - * @return mixed + * @return array|null */ public function getCustomRowObject(int $n, string $className); @@ -76,7 +79,7 @@ public function getCustomRowObject(int $n, string $className); * * If row doesn't exist, returns null. * - * @return mixed + * @return array|null */ public function getRowArray(int $n = 0); @@ -85,45 +88,45 @@ public function getRowArray(int $n = 0); * * If row doesn't exist, returns null. * - * @return mixed + * @return object|stdClass|null */ public function getRowObject(int $n = 0); /** * Assigns an item into a particular column slot. * - * @param string $key - * @param mixed $value + * @param array|string $key + * @param array|object|stdClass|null $value * - * @return mixed + * @return void */ public function setRow($key, $value = null); /** * Returns the "first" row of the current results. * - * @return mixed + * @return array|object|null */ public function getFirstRow(string $type = 'object'); /** * Returns the "last" row of the current results. * - * @return mixed + * @return array|object|null */ public function getLastRow(string $type = 'object'); /** * Returns the "next" row of the current results. * - * @return mixed + * @return array|object|null */ public function getNextRow(string $type = 'object'); /** * Returns the "previous" row of the current results. * - * @return mixed + * @return array|object|null */ public function getPreviousRow(string $type = 'object'); @@ -135,7 +138,7 @@ public function getNumRows(): int; /** * Returns an unbuffered row and move the pointer to the next row. * - * @return mixed + * @return array|object|null */ public function getUnbufferedRow(string $type = 'object'); @@ -164,7 +167,7 @@ public function freeResult(); * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool */ public function dataSeek(int $n = 0); } diff --git a/system/Database/SQLSRV/Result.php b/system/Database/SQLSRV/Result.php index 174b146aab44..0aa68b01e2ac 100755 --- a/system/Database/SQLSRV/Result.php +++ b/system/Database/SQLSRV/Result.php @@ -117,7 +117,7 @@ public function freeResult() * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool */ public function dataSeek(int $n = 0) { @@ -137,7 +137,7 @@ public function dataSeek(int $n = 0) * * Overridden by driver classes. * - * @return mixed + * @return array|false|null */ protected function fetchAssoc() { diff --git a/system/Database/SQLite3/Result.php b/system/Database/SQLite3/Result.php index d033b65891be..10c0ea00d232 100644 --- a/system/Database/SQLite3/Result.php +++ b/system/Database/SQLite3/Result.php @@ -94,7 +94,7 @@ public function freeResult() * internally before fetching results to make sure the result set * starts at zero. * - * @return mixed + * @return bool * * @throws DatabaseException */ @@ -112,7 +112,7 @@ public function dataSeek(int $n = 0) * * Overridden by driver classes. * - * @return mixed + * @return array|false */ protected function fetchAssoc() {