Skip to content

Commit 50c225c

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.4
Conflicts: phpstan-baseline.neon.dist
2 parents 09f62eb + 70eade0 commit 50c225c

40 files changed

Lines changed: 899 additions & 153 deletions

app/Config/Autoload.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
* can find the files as needed.
1414
*
1515
* NOTE: If you use an identical key in $psr4 or $classmap, then
16-
* the values in this file will overwrite the framework's values.
16+
* the values in this file will overwrite the framework's values.
17+
*
18+
* NOTE: This class is required prior to Autoloader instantiation,
19+
* and does not extend BaseConfig.
1720
*/
1821
class Autoload extends AutoloadConfig
1922
{

app/Config/Cache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ class Cache extends BaseConfig
9595
* A string of reserved characters that will not be allowed in keys or tags.
9696
* Strings that violate this restriction will cause handlers to throw.
9797
* Default: {}()/\@:
98-
* Note: The default set is required for PSR-6 compliance.
98+
*
99+
* NOTE: The default set is required for PSR-6 compliance.
99100
*/
100101
public string $reservedCharacters = '{}()/\@:';
101102

app/Config/ContentSecurityPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ContentSecurityPolicy extends BaseConfig
3939

4040
// -------------------------------------------------------------------------
4141
// Sources allowed
42-
// Note: once you set a policy to 'none', it cannot be further restricted
42+
// NOTE: once you set a policy to 'none', it cannot be further restricted
4343
// -------------------------------------------------------------------------
4444

4545
/**

app/Config/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Logger extends BaseConfig
9999
* An extension of 'php' allows for protecting the log files via basic
100100
* scripting, when they are to be stored under a publicly accessible directory.
101101
*
102-
* Note: Leaving it blank will default to 'log'.
102+
* NOTE: Leaving it blank will default to 'log'.
103103
*/
104104
'fileExtension' => '',
105105

app/Config/Migrations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Migrations extends BaseConfig
4040
* using the CLI command:
4141
* > php spark make:migration
4242
*
43-
* Note: if you set an unsupported format, migration runner will not find
43+
* NOTE: if you set an unsupported format, migration runner will not find
4444
* your migration files.
4545
*
4646
* Supported formats:

app/Config/Modules.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
use CodeIgniter\Modules\Modules as BaseModules;
66

7+
/**
8+
* Modules Configuration.
9+
*
10+
* NOTE: This class is required prior to Autoloader instantiation,
11+
* and does not extend BaseConfig.
12+
*/
713
class Modules extends BaseModules
814
{
915
/**

app/Config/Paths.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
* share a system folder between multiple applications, and more.
1313
*
1414
* All paths are relative to the project's root folder.
15+
*
16+
* NOTE: This class is required prior to Autoloader instantiation,
17+
* and does not extend BaseConfig.
18+
*
19+
* @immutable
1520
*/
1621
class Paths
1722
{

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"phpunit/phpcov": "^8.2",
2525
"phpunit/phpunit": "^9.1",
2626
"predis/predis": "^1.1 || ^2.0",
27-
"rector/rector": "0.17.3",
27+
"rector/rector": "0.17.6",
2828
"vimeo/psalm": "^5.0"
2929
},
3030
"suggest": {

phpstan-baseline.neon.dist

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ parameters:
1010
count: 1
1111
path: system/Autoloader/Autoloader.php
1212

13-
-
14-
message: "#^Property CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:\\$redis \\(Redis\\) in isset\\(\\) is not nullable\\.$#"
15-
count: 1
16-
path: system/Cache/Handlers/RedisHandler.php
17-
1813
-
1914
message: "#^Property CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:\\$db \\(CodeIgniter\\\\Database\\\\BaseConnection\\) in empty\\(\\) is not falsy\\.$#"
2015
count: 1
@@ -192,16 +187,11 @@ parameters:
192187

193188
-
194189
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRegisteredControllers\\(.*\\)\\.$#"
195-
count: 2
196-
path: system/Router/Router.php
197-
198-
-
199-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
200190
count: 1
201191
path: system/Router/Router.php
202192

203193
-
204-
message: "#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getRoutes\\(\\) invoked with 1 parameter, 0 required\\.$#"
194+
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
205195
count: 1
206196
path: system/Router/Router.php
207197

system/BaseModel.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ public function skipValidation(bool $skip = true)
13451345
}
13461346

13471347
/**
1348-
* Allows to set validation messages.
1348+
* Allows to set (and reset) validation messages.
13491349
* It could be used when you have to change default or override current validate messages.
13501350
*
13511351
* @param array $validationMessages Value
@@ -1376,7 +1376,7 @@ public function setValidationMessage(string $field, array $fieldMessages)
13761376
}
13771377

13781378
/**
1379-
* Allows to set validation rules.
1379+
* Allows to set (and reset) validation rules.
13801380
* It could be used when you have to change default or override current validate rules.
13811381
*
13821382
* @param array $validationRules Value
@@ -1401,6 +1401,17 @@ public function setValidationRules(array $validationRules)
14011401
*/
14021402
public function setValidationRule(string $field, $fieldRules)
14031403
{
1404+
$rules = $this->validationRules;
1405+
1406+
// ValidationRules can be either a string, which is the group name,
1407+
// or an array of rules.
1408+
if (is_string($rules)) {
1409+
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);
1410+
1411+
$this->validationRules = $rules;
1412+
$this->validationMessages = $this->validationMessages + $customErrors;
1413+
}
1414+
14041415
$this->validationRules[$field] = $fieldRules;
14051416

14061417
return $this;
@@ -1466,7 +1477,9 @@ public function getValidationRules(array $options = []): array
14661477
// ValidationRules can be either a string, which is the group name,
14671478
// or an array of rules.
14681479
if (is_string($rules)) {
1469-
$rules = $this->validation->loadRuleGroup($rules);
1480+
[$rules, $customErrors] = $this->validation->loadRuleGroup($rules);
1481+
1482+
$this->validationMessages = $this->validationMessages + $customErrors;
14701483
}
14711484

14721485
if (isset($options['except'])) {

0 commit comments

Comments
 (0)