Skip to content

Commit

Permalink
docs: improve doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 2, 2024
1 parent eb88917 commit 6d971af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions system/Database/BaseResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,16 @@ public function getResultObject(): array
* Wrapper object to return a row as either an array, an object, or
* a custom class.
*
* If row doesn't exist, returns null.
* 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 string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string|'array'|'object' $type
* @param int|string $n The index of the results to return, or column name.
* @param string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string<T>|'array'|'object' $type
*
* @return array|object|stdClass|null
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null))
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))
*/
public function getRow($n = 0, string $type = 'object')
{
Expand Down Expand Up @@ -296,7 +298,7 @@ public function getRow($n = 0, string $type = 'object')
*
* @template T of object
*
* @param int $n The row number of the results
* @param int $n The index of the results to return.
* @phpstan-param class-string<T> $className
*
* @return object|null
Expand Down
14 changes: 8 additions & 6 deletions system/Database/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ public function getResultObject(): array;
* Wrapper object to return a row as either an array, an object, or
* a custom class.
*
* If row doesn't exist, returns null.
* 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 string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string|'array'|'object' $type
* @param int|string $n The index of the results to return, or column name.
* @param string $type The type of result object. 'array', 'object' or class name.
* @phpstan-param class-string<T>|'array'|'object' $type
*
* @return array|object|stdClass|null
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null))
* @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null))
*/
public function getRow($n = 0, string $type = 'object');

Expand All @@ -73,7 +75,7 @@ public function getRow($n = 0, string $type = 'object');
*
* @template T of object
*
* @param int $n The row number of the results
* @param int $n The index of the results to return.
* @phpstan-param class-string<T> $className
*
* @return object|null
Expand Down

0 comments on commit 6d971af

Please sign in to comment.