From 49ac6640665ff71499d7a3b2d98b85dc26e137a6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 23 Nov 2023 21:12:06 +0900 Subject: [PATCH] docs: fix incorrect PHPDoc types --- system/Database/BaseResult.php | 6 ++++-- system/Database/ResultInterface.php | 5 +++-- system/Email/Email.php | 2 +- system/HTTP/Files/FileCollection.php | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/system/Database/BaseResult.php b/system/Database/BaseResult.php index c5f603a28127..6f6399cfb2fd 100644 --- a/system/Database/BaseResult.php +++ b/system/Database/BaseResult.php @@ -254,14 +254,16 @@ public function getResultObject(): array * * If row doesn't exist, returns null. * - * @param int $n The index of the results to return - * @param string $type The type of result object. 'array', 'object' or class name. + * @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 * * @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') { + // $n is a column name. if (! is_numeric($n)) { // We cache the row data for subsequent uses if (! is_array($this->rowData)) { diff --git a/system/Database/ResultInterface.php b/system/Database/ResultInterface.php index c959a7cb2292..b06de85ad3be 100644 --- a/system/Database/ResultInterface.php +++ b/system/Database/ResultInterface.php @@ -57,8 +57,9 @@ public function getResultObject(): array; * * If row doesn't exist, returns null. * - * @param int $n The index of the results to return - * @param string $type The type of result object. 'array', 'object' or class name. + * @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 * * @return array|object|stdClass|null * @phpstan-return ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : object|null)) diff --git a/system/Email/Email.php b/system/Email/Email.php index 0adb3e6eb5e6..37a5b56be98d 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -731,7 +731,7 @@ public function setHeader($header, $value) } /** - * @param string $email + * @param array|string $email * * @return array */ diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index f01cc69f5902..8cb1f913e8dc 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -77,7 +77,7 @@ public function getFile(string $name) /** * Verify if a file exist in the collection of uploaded files and is have been uploaded with multiple option. * - * @return array|null + * @return list|null */ public function getFileMultiple(string $name) { @@ -245,7 +245,7 @@ protected function fixFilesArray(array $data): array * @param array $index The index sequence we are navigating down * @param array $value The portion of the array to process * - * @return UploadedFile|null + * @return list|UploadedFile|null */ protected function getValueDotNotationSyntax(array $index, array $value) {