Skip to content

Commit 4de207d

Browse files
committed
docs: replace mixed type at the remaining database Result class.
1 parent 3897361 commit 4de207d

7 files changed

Lines changed: 32 additions & 29 deletions

File tree

system/Database/BaseResult.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,10 @@ public function getRowObject(int $n = 0)
356356
/**
357357
* Assigns an item into a particular column slot.
358358
*
359-
* @param mixed $key
360-
* @param mixed $value
359+
* @param array|string $key
360+
* @param array|object|stdClass|null $value
361361
*
362-
* @return mixed
362+
* @return void
363363
*/
364364
public function setRow($key, $value = null)
365365
{
@@ -507,7 +507,7 @@ abstract public function freeResult();
507507
* internally before fetching results to make sure the result set
508508
* starts at zero.
509509
*
510-
* @return mixed
510+
* @return bool
511511
*/
512512
abstract public function dataSeek(int $n = 0);
513513

@@ -516,7 +516,7 @@ abstract public function dataSeek(int $n = 0);
516516
*
517517
* Overridden by driver classes.
518518
*
519-
* @return mixed
519+
* @return array|false|null
520520
*/
521521
abstract protected function fetchAssoc();
522522

system/Database/MySQLi/Result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function freeResult()
117117
* internally before fetching results to make sure the result set
118118
* starts at zero.
119119
*
120-
* @return mixed
120+
* @return bool
121121
*/
122122
public function dataSeek(int $n = 0)
123123
{
@@ -129,7 +129,7 @@ public function dataSeek(int $n = 0)
129129
*
130130
* Overridden by driver classes.
131131
*
132-
* @return mixed
132+
* @return array|false|null
133133
*/
134134
protected function fetchAssoc()
135135
{

system/Database/OCI8/Result.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function dataSeek(int $n = 0)
8080
*
8181
* Overridden by driver classes.
8282
*
83-
* @return mixed
83+
* @return array|false
8484
*/
8585
protected function fetchAssoc()
8686
{

system/Database/Postgre/Result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function freeResult()
8383
* internally before fetching results to make sure the result set
8484
* starts at zero.
8585
*
86-
* @return mixed
86+
* @return bool
8787
*/
8888
public function dataSeek(int $n = 0)
8989
{
@@ -95,7 +95,7 @@ public function dataSeek(int $n = 0)
9595
*
9696
* Overridden by driver classes.
9797
*
98-
* @return mixed
98+
* @return array|false
9999
*/
100100
protected function fetchAssoc()
101101
{

system/Database/ResultInterface.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace CodeIgniter\Database;
1313

14+
use stdClass;
15+
1416
/**
1517
* @template TConnection of object|resource
1618
* @template TResult of object|resource
@@ -31,7 +33,7 @@ public function getResult(string $type = 'object'): array;
3133
*
3234
* @param string $className The name of the class to use.
3335
*
34-
* @return mixed
36+
* @return array
3537
*/
3638
public function getCustomResultObject(string $className);
3739

@@ -55,10 +57,11 @@ public function getResultObject(): array;
5557
*
5658
* If row doesn't exist, returns null.
5759
*
58-
* @param mixed $n The index of the results to return
60+
* @param int $n The index of the results to return
5961
* @param string $type The type of result object. 'array', 'object' or class name.
6062
*
61-
* @return mixed
63+
* @return array|object|stdClass|null
64+
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null))
6265
*/
6366
public function getRow($n = 0, string $type = 'object');
6467

@@ -67,7 +70,7 @@ public function getRow($n = 0, string $type = 'object');
6770
*
6871
* If row doesn't exists, returns null.
6972
*
70-
* @return mixed
73+
* @return array|null
7174
*/
7275
public function getCustomRowObject(int $n, string $className);
7376

@@ -76,7 +79,7 @@ public function getCustomRowObject(int $n, string $className);
7679
*
7780
* If row doesn't exist, returns null.
7881
*
79-
* @return mixed
82+
* @return array|null
8083
*/
8184
public function getRowArray(int $n = 0);
8285

@@ -85,45 +88,45 @@ public function getRowArray(int $n = 0);
8588
*
8689
* If row doesn't exist, returns null.
8790
*
88-
* @return mixed
91+
* @return object|stdClass|null
8992
*/
9093
public function getRowObject(int $n = 0);
9194

9295
/**
9396
* Assigns an item into a particular column slot.
9497
*
95-
* @param string $key
96-
* @param mixed $value
98+
* @param array|string $key
99+
* @param array|object|stdClass|null $value
97100
*
98-
* @return mixed
101+
* @return void
99102
*/
100103
public function setRow($key, $value = null);
101104

102105
/**
103106
* Returns the "first" row of the current results.
104107
*
105-
* @return mixed
108+
* @return array|object|null
106109
*/
107110
public function getFirstRow(string $type = 'object');
108111

109112
/**
110113
* Returns the "last" row of the current results.
111114
*
112-
* @return mixed
115+
* @return array|object|null
113116
*/
114117
public function getLastRow(string $type = 'object');
115118

116119
/**
117120
* Returns the "next" row of the current results.
118121
*
119-
* @return mixed
122+
* @return array|object|null
120123
*/
121124
public function getNextRow(string $type = 'object');
122125

123126
/**
124127
* Returns the "previous" row of the current results.
125128
*
126-
* @return mixed
129+
* @return array|object|null
127130
*/
128131
public function getPreviousRow(string $type = 'object');
129132

@@ -135,7 +138,7 @@ public function getNumRows(): int;
135138
/**
136139
* Returns an unbuffered row and move the pointer to the next row.
137140
*
138-
* @return mixed
141+
* @return array|object|null
139142
*/
140143
public function getUnbufferedRow(string $type = 'object');
141144

@@ -164,7 +167,7 @@ public function freeResult();
164167
* internally before fetching results to make sure the result set
165168
* starts at zero.
166169
*
167-
* @return mixed
170+
* @return bool
168171
*/
169172
public function dataSeek(int $n = 0);
170173
}

system/Database/SQLSRV/Result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function freeResult()
117117
* internally before fetching results to make sure the result set
118118
* starts at zero.
119119
*
120-
* @return mixed
120+
* @return bool
121121
*/
122122
public function dataSeek(int $n = 0)
123123
{
@@ -137,7 +137,7 @@ public function dataSeek(int $n = 0)
137137
*
138138
* Overridden by driver classes.
139139
*
140-
* @return mixed
140+
* @return array|false|null
141141
*/
142142
protected function fetchAssoc()
143143
{

system/Database/SQLite3/Result.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function freeResult()
9494
* internally before fetching results to make sure the result set
9595
* starts at zero.
9696
*
97-
* @return mixed
97+
* @return bool
9898
*
9999
* @throws DatabaseException
100100
*/
@@ -112,7 +112,7 @@ public function dataSeek(int $n = 0)
112112
*
113113
* Overridden by driver classes.
114114
*
115-
* @return mixed
115+
* @return array|false
116116
*/
117117
protected function fetchAssoc()
118118
{

0 commit comments

Comments
 (0)