From 1955a33b992823a3bec5eb5dd2b8716dc3819636 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 15:15:28 +0000 Subject: [PATCH 1/3] chore(deps-dev): update rector/rector requirement from 2.0.8 to 2.0.9 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/2.0.8...2.0.9) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8797584457ea..96a555a20562 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "phpunit/phpcov": "^9.0.2 || ^10.0", "phpunit/phpunit": "^10.5.16 || ^11.2", "predis/predis": "^1.1 || ^2.3", - "rector/rector": "2.0.8", + "rector/rector": "2.0.9", "shipmonk/phpstan-baseline-per-identifier": "^2.0" }, "replace": { From 65b71e963b1cb6f36b284ae0e5be13faabe33ff4 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 10 Feb 2025 22:37:03 +0700 Subject: [PATCH 2/3] refactor: re-run rector --- tests/system/Database/Live/ForgeTest.php | 6 +++--- tests/system/Database/Live/GetTest.php | 2 +- tests/system/Log/LoggerTest.php | 2 +- tests/system/Models/FindModelTest.php | 2 +- tests/system/View/ViewTest.php | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index ab5b17bec174..6c43c246cf7e 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -1292,7 +1292,7 @@ public function testSetKeyNames(): void $this->forge->dropKey('forge_test_1', $index, false); $this->forge->dropKey('forge_test_1', $uniqueIndex, false); - $this->assertCount(0, $this->db->getIndexData('forge_test_1')); + $this->assertEmpty($this->db->getIndexData('forge_test_1')); $this->forge->dropTable('forge_test_1', true); } @@ -1500,7 +1500,7 @@ public function testDropTableSuccess(): void $this->assertFalse($this->db->tableExists('dropTest')); if ($this->db->DBDriver === 'SQLite3') { - $this->assertCount(0, $this->db->getIndexData('droptest')); + $this->assertEmpty($this->db->getIndexData('droptest')); } } @@ -1668,7 +1668,7 @@ public function testDropPrimaryKey(): void $indexes = $this->db->getIndexData('forge_test_users'); - $this->assertCount(0, $indexes); + $this->assertEmpty($indexes); $this->forge->dropTable('forge_test_users', true); } diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index ce98ebf413e0..3bfa417f9127 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -58,7 +58,7 @@ public function testGetWithLimitZero(): void $jobs = $this->db->table('job')->limit(0)->get()->getResult(); - $this->assertCount(0, $jobs); + $this->assertEmpty($jobs); } public function testGetWithLimitZeroAsAll(): void diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index 569de4dbd33d..497ff9fe47a0 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -103,7 +103,7 @@ public function testLogDoesnotLogUnhandledLevels(): void $logs = TestHandler::getLogs(); - $this->assertCount(0, $logs); + $this->assertEmpty($logs); } public function testLogInterpolatesMessage(): void diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index 43fb96d76b53..cd62f2dec107 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -130,7 +130,7 @@ public function testFindClearsBinds(): void // Binds should be reset to 0 after each one $binds = $this->model->builder()->getBinds(); - $this->assertCount(0, $binds); + $this->assertEmpty($binds); $query = $this->model->getLastQuery(); $this->assertCount(1, $this->getPrivateProperty($query, 'binds')); diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index b15e603408d8..c1fc85ede201 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -250,7 +250,7 @@ public function testPerformanceLogging(): void { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, true); - $this->assertCount(0, $view->getPerformanceData()); + $this->assertEmpty($view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; @@ -262,12 +262,12 @@ public function testPerformanceNonLogging(): void { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, false); - $this->assertCount(0, $view->getPerformanceData()); + $this->assertEmpty($view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; $this->assertSame($expected, $view->renderString('

', [], true)); - $this->assertCount(0, $view->getPerformanceData()); + $this->assertEmpty($view->getPerformanceData()); } public function testRenderLayoutExtendsCorrectly(): void From 1925f692bcc60deb81b103e8814687fd6e53094e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 11 Feb 2025 14:30:12 +0700 Subject: [PATCH 3/3] fix Revert "refactor: re-run rector" This reverts commit 65b71e963b1cb6f36b284ae0e5be13faabe33ff4. fix: skip rector.php --- rector.php | 3 +++ tests/system/Database/Live/ForgeTest.php | 6 +++--- tests/system/Database/Live/GetTest.php | 2 +- tests/system/Log/LoggerTest.php | 2 +- tests/system/Models/FindModelTest.php | 2 +- tests/system/View/ViewTest.php | 6 +++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rector.php b/rector.php index ffa21b4e663e..7adec00da4bd 100644 --- a/rector.php +++ b/rector.php @@ -37,6 +37,7 @@ use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector; +use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector; use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; @@ -168,6 +169,8 @@ NullToStrictStringFuncCallArgRector::class, CompactToVariablesRector::class, + + AssertCountWithZeroToAssertEmptyRector::class, ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 6c43c246cf7e..ab5b17bec174 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -1292,7 +1292,7 @@ public function testSetKeyNames(): void $this->forge->dropKey('forge_test_1', $index, false); $this->forge->dropKey('forge_test_1', $uniqueIndex, false); - $this->assertEmpty($this->db->getIndexData('forge_test_1')); + $this->assertCount(0, $this->db->getIndexData('forge_test_1')); $this->forge->dropTable('forge_test_1', true); } @@ -1500,7 +1500,7 @@ public function testDropTableSuccess(): void $this->assertFalse($this->db->tableExists('dropTest')); if ($this->db->DBDriver === 'SQLite3') { - $this->assertEmpty($this->db->getIndexData('droptest')); + $this->assertCount(0, $this->db->getIndexData('droptest')); } } @@ -1668,7 +1668,7 @@ public function testDropPrimaryKey(): void $indexes = $this->db->getIndexData('forge_test_users'); - $this->assertEmpty($indexes); + $this->assertCount(0, $indexes); $this->forge->dropTable('forge_test_users', true); } diff --git a/tests/system/Database/Live/GetTest.php b/tests/system/Database/Live/GetTest.php index 3bfa417f9127..ce98ebf413e0 100644 --- a/tests/system/Database/Live/GetTest.php +++ b/tests/system/Database/Live/GetTest.php @@ -58,7 +58,7 @@ public function testGetWithLimitZero(): void $jobs = $this->db->table('job')->limit(0)->get()->getResult(); - $this->assertEmpty($jobs); + $this->assertCount(0, $jobs); } public function testGetWithLimitZeroAsAll(): void diff --git a/tests/system/Log/LoggerTest.php b/tests/system/Log/LoggerTest.php index 497ff9fe47a0..569de4dbd33d 100644 --- a/tests/system/Log/LoggerTest.php +++ b/tests/system/Log/LoggerTest.php @@ -103,7 +103,7 @@ public function testLogDoesnotLogUnhandledLevels(): void $logs = TestHandler::getLogs(); - $this->assertEmpty($logs); + $this->assertCount(0, $logs); } public function testLogInterpolatesMessage(): void diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index cd62f2dec107..43fb96d76b53 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -130,7 +130,7 @@ public function testFindClearsBinds(): void // Binds should be reset to 0 after each one $binds = $this->model->builder()->getBinds(); - $this->assertEmpty($binds); + $this->assertCount(0, $binds); $query = $this->model->getLastQuery(); $this->assertCount(1, $this->getPrivateProperty($query, 'binds')); diff --git a/tests/system/View/ViewTest.php b/tests/system/View/ViewTest.php index c1fc85ede201..b15e603408d8 100644 --- a/tests/system/View/ViewTest.php +++ b/tests/system/View/ViewTest.php @@ -250,7 +250,7 @@ public function testPerformanceLogging(): void { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, true); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; @@ -262,12 +262,12 @@ public function testPerformanceNonLogging(): void { // Make sure debugging is on for our view $view = new View($this->config, $this->viewsDir, $this->loader, false); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); $view->setVar('testString', 'Hello World'); $expected = '

Hello World

'; $this->assertSame($expected, $view->renderString('

', [], true)); - $this->assertEmpty($view->getPerformanceData()); + $this->assertCount(0, $view->getPerformanceData()); } public function testRenderLayoutExtendsCorrectly(): void