Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix PHPDoc types in BaseModel #8679

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading