From 7c8216ffbc97eb8a24e6bd7f366f374d7daa84da Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 16 Oct 2024 02:28:17 +0700 Subject: [PATCH] Refactor: enable Rector Code Quality level, apply level 9 for SimplifyConditionsRector --- rector.php | 7 ++----- tests/system/Database/Live/UpdateTest.php | 10 +++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/rector.php b/rector.php index 8fd3ab275345..4c15387198d9 100644 --- a/rector.php +++ b/rector.php @@ -12,13 +12,11 @@ */ use Rector\Caching\ValueObject\Storage\FileCacheStorage; -use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector; use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector; -use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector; use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector; use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; use Rector\CodeQuality\Rector\If_\CombineIfRector; @@ -190,7 +188,6 @@ CountArrayToEmptyArrayComparisonRector::class, ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, - SimplifyStrposLowerRector::class, CombineIfRector::class, SimplifyIfReturnBoolRector::class, InlineIfToExplicitIfRector::class, @@ -203,7 +200,6 @@ RemoveErrorSuppressInTryCatchStmtsRector::class, FuncGetArgsToVariadicParamRector::class, MakeInheritedMethodVisibilitySameAsParentRector::class, - SimplifyEmptyArrayCheckRector::class, SimplifyEmptyCheckOnEmptyArrayRector::class, TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, EmptyOnNullableObjectToInstanceOfRector::class, @@ -223,4 +219,5 @@ ->withConfiguredRule(StringClassNameToClassConstantRector::class, [ // keep '\\' prefix string on string '\Foo\Bar' StringClassNameToClassConstantRector::SHOULD_KEEP_PRE_SLASH => true, - ]); + ]) + ->withCodeQualityLevel(9); diff --git a/tests/system/Database/Live/UpdateTest.php b/tests/system/Database/Live/UpdateTest.php index 8af549fc638e..565c8f83b909 100644 --- a/tests/system/Database/Live/UpdateTest.php +++ b/tests/system/Database/Live/UpdateTest.php @@ -466,7 +466,7 @@ public function testUpdateBatchConstraintsRawSqlAndAlias(): void public function testUpdateBatchUpdateFieldsAndAlias(): void { - if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { + if ($this->db->DBDriver === 'SQLite3' && version_compare($this->db->getVersion(), '3.33.0') < 0) { $this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); } @@ -557,7 +557,7 @@ public function testUpdateBatchUpdateFieldsAndAlias(): void public function testUpdateBatchWithoutOnConstraint(): void { - if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { + if ($this->db->DBDriver === 'SQLite3' && version_compare($this->db->getVersion(), '3.33.0') < 0) { $this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); } @@ -599,7 +599,7 @@ public function testUpdateBatchWithoutOnConstraint(): void public function testRawSqlConstraint(): void { - if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { + if ($this->db->DBDriver === 'SQLite3' && version_compare($this->db->getVersion(), '3.33.0') < 0) { $this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); } @@ -623,7 +623,7 @@ public function testRawSqlConstraint(): void public function testRawSqlConstraintWithKey(): void { - if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { + if ($this->db->DBDriver === 'SQLite3' && version_compare($this->db->getVersion(), '3.33.0') < 0) { $this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); } @@ -710,7 +710,7 @@ public function testUpdateBatchWithQuery(): void ]; $this->db->table('user2')->insertBatch($data); - if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { + if ($this->db->DBDriver === 'SQLite3' && version_compare($this->db->getVersion(), '3.33.0') < 0) { $this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); }