Skip to content

Commit 4eed29c

Browse files
authored
Merge pull request #8245 from kenjis/docs-fix-model-phpdoc-types
docs: fix PHPDoc types for Model
2 parents 8657525 + 6bb7c52 commit 4eed29c

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,11 +2641,6 @@
26412641
'count' => 1,
26422642
'path' => __DIR__ . '/system/Model.php',
26432643
];
2644-
$ignoreErrors[] = [
2645-
'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\\(\\)$#',
2646-
'count' => 1,
2647-
'path' => __DIR__ . '/system/Model.php',
2648-
];
26492644
$ignoreErrors[] = [
26502645
'message' => '#^Accessing offset mixed directly on \\$_GET is discouraged\\.$#',
26512646
'count' => 1,

system/BaseModel.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,12 @@ public function getInsertID()
740740
* Inserts data into the database. If an object is provided,
741741
* it will attempt to convert it to an array.
742742
*
743-
* @param array|object|null $data Data
744-
* @param bool $returnID Whether insert ID should be returned or not.
743+
* @param array|object|null $data Data
744+
* @phpstan-param row_array|object|null $data
745+
* @param bool $returnID Whether insert ID should be returned or not.
745746
*
746747
* @return bool|int|string insert ID or true on success. false on failure.
748+
* @phpstan-return ($returnID is true ? int|string|false : bool)
747749
*
748750
* @throws ReflectionException
749751
*/

system/Model.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,11 @@ protected function shouldUpdate($data): bool
697697
* it will attempt to convert it to an array.
698698
*
699699
* @param array|object|null $data
700-
* @param bool $returnID Whether insert ID should be returned or not.
700+
* @phpstan-param row_array|object|null $data
701+
* @param bool $returnID Whether insert ID should be returned or not.
701702
*
702-
* @return BaseResult|false|int|object|string
703+
* @return false|int|object|string
704+
* @phpstan-return ($returnID is true ? int|string|false : bool)
703705
*
704706
* @throws ReflectionException
705707
*/

0 commit comments

Comments
 (0)