Skip to content

Commit 62a83bb

Browse files
authored
Merge pull request #9747 from samsonasik/chore-bump-rector-221
chore: Bump rector to 2.2.1 and re-run it with increase code quality level to 53
2 parents 4806e65 + 253f9f5 commit 62a83bb

File tree

8 files changed

+9
-15
lines changed

8 files changed

+9
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpcov": "^9.0.2 || ^10.0",
2929
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^3.0",
31-
"rector/rector": "2.1.7",
31+
"rector/rector": "2.2.1",
3232
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3333
},
3434
"replace": {

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@
202202
// keep '\\' prefix string on string '\Foo\Bar'
203203
StringClassNameToClassConstantRector::SHOULD_KEEP_PRE_SLASH => true,
204204
])
205-
->withCodeQualityLevel(52);
205+
->withCodeQualityLevel(53);

system/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ protected function shouldUpdate($row): bool
769769
{
770770
$id = $this->getIdValue($row);
771771

772-
return ! ($id === null || $id === [] || $id === '');
772+
return ! in_array($id, [null, [], ''], true);
773773
}
774774

775775
/**

system/Common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ function stringify_attributes($attributes, bool $js = false): string
11211121
{
11221122
$atts = '';
11231123

1124-
if ($attributes === '' || $attributes === [] || $attributes === null) {
1124+
if (in_array($attributes, ['', [], null], true)) {
11251125
return $atts;
11261126
}
11271127

system/Database/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function parseDSN(array $params): array
9696
{
9797
$dsn = parse_url($params['DSN']);
9898

99-
if ($dsn === 0 || $dsn === '' || $dsn === '0' || $dsn === [] || $dsn === false || $dsn === null) {
99+
if (in_array($dsn, [0, '', '0', [], false, null], true)) {
100100
throw new InvalidArgumentException('Your DSN connection string is invalid.');
101101
}
102102

system/Validation/FormatRules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public function valid_url($str = null): bool
422422
*/
423423
public function valid_url_strict($str = null, ?string $validSchemes = null): bool
424424
{
425-
if ($str === null || $str === '' || $str === '0') {
425+
if (in_array($str, [null, '', '0'], true)) {
426426
return false;
427427
}
428428

system/View/Cell.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
125125
public function prepareParams($params)
126126
{
127127
if (
128-
($params === null || $params === '' || $params === [])
128+
in_array($params, [null, '', []], true)
129129
|| (! is_string($params) && ! is_array($params))
130130
) {
131131
return [];

tests/system/Models/UpdateModelTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,7 @@ public function testUpdateSetEntity(): void
432432
public function testUpdateEntityWithPrimaryKeyCast(): void
433433
{
434434
if (
435-
$this->db->DBDriver === 'OCI8'
436-
|| $this->db->DBDriver === 'Postgre'
437-
|| $this->db->DBDriver === 'SQLSRV'
438-
|| $this->db->DBDriver === 'SQLite3'
435+
in_array($this->db->DBDriver, ['OCI8', 'Postgre', 'SQLSRV', 'SQLite3'], true)
439436
) {
440437
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
441438
}
@@ -464,10 +461,7 @@ public function testUpdateEntityWithPrimaryKeyCast(): void
464461
public function testUpdateBatchEntityWithPrimaryKeyCast(): void
465462
{
466463
if (
467-
$this->db->DBDriver === 'OCI8'
468-
|| $this->db->DBDriver === 'Postgre'
469-
|| $this->db->DBDriver === 'SQLSRV'
470-
|| $this->db->DBDriver === 'SQLite3'
464+
in_array($this->db->DBDriver, ['OCI8', 'Postgre', 'SQLSRV', 'SQLite3'], true)
471465
) {
472466
$this->markTestSkipped($this->db->DBDriver . ' does not work with binary data as string data.');
473467
}

0 commit comments

Comments
 (0)