Skip to content

Commit f5043f5

Browse files
committed
docs: fix PHPDoc types
1 parent 6624395 commit f5043f5

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

system/Database/BaseResult.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter\Database;
1313

1414
use CodeIgniter\Entity\Entity;
15+
use stdClass;
1516

1617
/**
1718
* @template TConnection of object|resource
@@ -116,7 +117,9 @@ public function getResult(string $type = 'object'): array
116117
/**
117118
* Returns the results as an array of custom objects.
118119
*
119-
* @return mixed
120+
* @phpstan-param class-string $className
121+
*
122+
* @return array
120123
*/
121124
public function getCustomResultObject(string $className)
122125
{
@@ -205,6 +208,9 @@ public function getResultArray(): array
205208
* Returns the results as an array of objects.
206209
*
207210
* If no results, an empty array is returned.
211+
*
212+
* @return array<int, stdClass>
213+
* @phpstan-return list<stdClass>
208214
*/
209215
public function getResultObject(): array
210216
{
@@ -248,10 +254,11 @@ public function getResultObject(): array
248254
*
249255
* If row doesn't exist, returns null.
250256
*
251-
* @param mixed $n The index of the results to return
257+
* @param int $n The index of the results to return
252258
* @param string $type The type of result object. 'array', 'object' or class name.
253259
*
254-
* @return mixed
260+
* @return array|object|stdClass|null
261+
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null))
255262
*/
256263
public function getRow($n = 0, string $type = 'object')
257264
{
@@ -285,7 +292,7 @@ public function getRow($n = 0, string $type = 'object')
285292
*
286293
* If row doesn't exists, returns null.
287294
*
288-
* @return mixed
295+
* @return array|null
289296
*/
290297
public function getCustomRowObject(int $n, string $className)
291298
{
@@ -309,7 +316,7 @@ public function getCustomRowObject(int $n, string $className)
309316
*
310317
* If row doesn't exist, returns null.
311318
*
312-
* @return mixed
319+
* @return array|null
313320
*/
314321
public function getRowArray(int $n = 0)
315322
{
@@ -330,7 +337,7 @@ public function getRowArray(int $n = 0)
330337
*
331338
* If row doesn't exist, returns null.
332339
*
333-
* @return mixed
340+
* @return object|stdClass|null
334341
*/
335342
public function getRowObject(int $n = 0)
336343
{
@@ -377,7 +384,7 @@ public function setRow($key, $value = null)
377384
/**
378385
* Returns the "first" row of the current results.
379386
*
380-
* @return mixed
387+
* @return array|object|null
381388
*/
382389
public function getFirstRow(string $type = 'object')
383390
{
@@ -389,7 +396,7 @@ public function getFirstRow(string $type = 'object')
389396
/**
390397
* Returns the "last" row of the current results.
391398
*
392-
* @return mixed
399+
* @return array|object|null
393400
*/
394401
public function getLastRow(string $type = 'object')
395402
{
@@ -401,7 +408,7 @@ public function getLastRow(string $type = 'object')
401408
/**
402409
* Returns the "next" row of the current results.
403410
*
404-
* @return mixed
411+
* @return array|object|null
405412
*/
406413
public function getNextRow(string $type = 'object')
407414
{
@@ -416,7 +423,7 @@ public function getNextRow(string $type = 'object')
416423
/**
417424
* Returns the "previous" row of the current results.
418425
*
419-
* @return mixed
426+
* @return array|object|null
420427
*/
421428
public function getPreviousRow(string $type = 'object')
422429
{
@@ -435,7 +442,7 @@ public function getPreviousRow(string $type = 'object')
435442
/**
436443
* Returns an unbuffered row and move the pointer to the next row.
437444
*
438-
* @return mixed
445+
* @return array|object|null
439446
*/
440447
public function getUnbufferedRow(string $type = 'object')
441448
{

0 commit comments

Comments
 (0)