Skip to content

Commit

Permalink
Merge pull request #8679 from kenjis/fix-phpdoc-type-BaseModel
Browse files Browse the repository at this point in the history
docs: fix PHPDoc types in BaseModel
  • Loading branch information
kenjis authored Mar 30, 2024
2 parents 7ca24b2 + f54cdde commit 3b86d09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 48 deletions.
45 changes: 0 additions & 45 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,6 @@
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:setValidationRules\\(\\) has parameter \\$validationRules with no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:transformDataToArray\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
Expand Down Expand Up @@ -11391,16 +11386,6 @@
'count' => 1,
'path' => __DIR__ . '/tests/_support/Models/UserModel.php',
];
$ignoreErrors[] = [
'message' => '#^Property Tests\\\\Support\\\\Models\\\\ValidErrorsModel\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, array\\<int\\|string, array\\<string, string\\>\\|string\\>\\|string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/_support/Models/ValidErrorsModel.php',
];
$ignoreErrors[] = [
'message' => '#^Property Tests\\\\Support\\\\Models\\\\ValidModel\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, array\\<int, string\\>\\|string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/_support/Models/ValidModel.php',
];
$ignoreErrors[] = [
'message' => '#^Property Tests\\\\Support\\\\SomeEntity\\:\\:\\$attributes type has no value type specified in iterable type array\\.$#',
'count' => 1,
Expand Down Expand Up @@ -16301,41 +16286,11 @@
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/UpdateModelTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelRuleGroupTest\\.php\\:368\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelRuleGroupTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelRuleGroupTest\\.php\\:406\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelRuleGroupTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelRuleGroupTest\\.php\\:446\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelRuleGroupTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelTest\\.php\\:243\\:\\:\\$grouptest has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelTest\\.php\\:380\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelTest\\.php\\:418\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelTest.php',
];
$ignoreErrors[] = [
'message' => '#^Property class@anonymous/tests/system/Models/ValidationModelTest\\.php\\:458\\:\\:\\$validationRules \\(array\\<int, string\\>\\|string\\) does not accept default value of type array\\<string, string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/Models/ValidationModelTest.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access property \\$key on array\\.$#',
'count' => 7,
Expand Down
9 changes: 6 additions & 3 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ abstract class BaseModel
protected $db;

/**
* Rules used to validate data in insert, update, and save methods.
* Rules used to validate data in insert(), update(), and save() methods.
*
* The array must match the format of data passed to the Validation
* library.
*
* @var list<string>|string
* @see https://codeigniter4.github.io/userguide/models/model.html#setting-validation-rules
*
* @var array<string, array<string, array<string, string>|string>|string>|string
*/
protected $validationRules = [];

Expand Down Expand Up @@ -1448,7 +1451,7 @@ public function setValidationMessage(string $field, array $fieldMessages)
* Allows to set (and reset) validation rules.
* It could be used when you have to change default or override current validate rules.
*
* @param array $validationRules Value
* @param array<string, array<string, array<string, string>|string>|string> $validationRules Value
*
* @return $this
*/
Expand Down

0 comments on commit 3b86d09

Please sign in to comment.