Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix incorrect @return type in ResultInterface-getCustomRowObject() #8503

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 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 @@ -292,9 +294,15 @@ public function getRow($n = 0, string $type = 'object')
/**
* Returns a row as a custom class instance.
*
* If row doesn't exists, returns null.
* If the row doesn't exist, returns null.
*
* @return array|null
* @template T of object
*
* @param int $n The index of the results to return.
* @phpstan-param class-string<T> $className
*
* @return object|null
* @phpstan-return T|null
*/
public function getCustomRowObject(int $n, string $className)
{
Expand Down
22 changes: 15 additions & 7 deletions system/Database/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,31 @@ 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');

/**
* Returns a row as a custom class instance.
*
* If row doesn't exists, returns null.
* If the row doesn't exist, returns null.
*
* @return array|null
* @template T of object
*
* @param int $n The index of the results to return.
* @phpstan-param class-string<T> $className
*
* @return object|null
* @phpstan-return T|null
*/
public function getCustomRowObject(int $n, string $className);

Expand Down
Loading