Skip to content

Commit

Permalink
Merge pull request #8244 from kenjis/fix-phpdoc-types-for-psalm
Browse files Browse the repository at this point in the history
docs: fix incorrect PHPDoc types
  • Loading branch information
kenjis authored Nov 25, 2023
2 parents 1d6b7ac + 49ac664 commit e346a6f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions system/Database/BaseResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
5 changes: 3 additions & 2 deletions system/Database/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion system/Email/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ public function setHeader($header, $value)
}

/**
* @param string $email
* @param array|string $email
*
* @return array
*/
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/Files/FileCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<UploadedFile>|null
*/
public function getFileMultiple(string $name)
{
Expand Down Expand Up @@ -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>|UploadedFile|null
*/
protected function getValueDotNotationSyntax(array $index, array $value)
{
Expand Down

0 comments on commit e346a6f

Please sign in to comment.