Skip to content

Commit

Permalink
Merge pull request #8245 from kenjis/docs-fix-model-phpdoc-types
Browse files Browse the repository at this point in the history
docs: fix PHPDoc types for Model
  • Loading branch information
kenjis authored Nov 27, 2023
2 parents 8657525 + 6bb7c52 commit 4eed29c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2641,11 +2641,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Return type \\(int\\|object\\|string\\|false\\) of method CodeIgniter\\\\Model\\:\\:insert\\(\\) should be covariant with return type \\(bool\\|int\\|string\\) of method CodeIgniter\\\\BaseModel\\:\\:insert\\(\\)$#',
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Accessing offset mixed directly on \\$_GET is discouraged\\.$#',
'count' => 1,
Expand Down
6 changes: 4 additions & 2 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,12 @@ public function getInsertID()
* Inserts data into the database. If an object is provided,
* it will attempt to convert it to an array.
*
* @param array|object|null $data Data
* @param bool $returnID Whether insert ID should be returned or not.
* @param array|object|null $data Data
* @phpstan-param row_array|object|null $data
* @param bool $returnID Whether insert ID should be returned or not.
*
* @return bool|int|string insert ID or true on success. false on failure.
* @phpstan-return ($returnID is true ? int|string|false : bool)
*
* @throws ReflectionException
*/
Expand Down
6 changes: 4 additions & 2 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,11 @@ protected function shouldUpdate($data): bool
* it will attempt to convert it to an array.
*
* @param array|object|null $data
* @param bool $returnID Whether insert ID should be returned or not.
* @phpstan-param row_array|object|null $data
* @param bool $returnID Whether insert ID should be returned or not.
*
* @return BaseResult|false|int|object|string
* @return false|int|object|string
* @phpstan-return ($returnID is true ? int|string|false : bool)
*
* @throws ReflectionException
*/
Expand Down

0 comments on commit 4eed29c

Please sign in to comment.