From a19f3e89765de6efb98e56212861ffe93306c34c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:01:05 +0000 Subject: [PATCH 1/4] chore(deps-dev): update rector/rector requirement from 2.2.6 to 2.2.7 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.2.6...2.2.7) --- updated-dependencies: - dependency-name: rector/rector dependency-version: 2.2.7 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 7e1248632c07..572c88c4b1e8 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": "^3.0", - "rector/rector": "2.2.6", + "rector/rector": "2.2.7", "shipmonk/phpstan-baseline-per-identifier": "^2.0" }, "replace": { From 308bdebf7f2ef6d010db5b459e4978b5c75c0912 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 31 Oct 2025 20:22:30 +0700 Subject: [PATCH 2/4] refactor: re-run rector to remove null arg on default null param --- system/Debug/Toolbar/Collectors/Database.php | 2 +- system/Model.php | 8 ++--- system/Test/FeatureTestTrait.php | 2 +- tests/system/CommonFunctionsTest.php | 2 +- tests/system/Config/ServicesTest.php | 10 +++---- tests/system/Database/Builder/UpdateTest.php | 29 +++++++++---------- tests/system/Database/Builder/WhereTest.php | 10 +++---- tests/system/Database/Live/WhereTest.php | 2 +- .../Database/Live/WriteTypeQueryTest.php | 2 +- tests/system/HTTP/HeaderTest.php | 6 ++-- tests/system/HTTP/IncomingRequestTest.php | 2 +- tests/system/Helpers/DateHelperTest.php | 4 +-- .../system/Helpers/URLHelper/SiteUrlTest.php | 6 ++-- tests/system/Models/CountAllModelTest.php | 4 +-- tests/system/Test/FabricatorTest.php | 2 +- 15 files changed, 44 insertions(+), 47 deletions(-) diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index 482c9fbcdf0f..be57931b30f9 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -104,7 +104,7 @@ public static function collect(Query $query) static::$queries[] = [ 'query' => $query, 'string' => $queryString, - 'duplicate' => in_array($queryString, array_column(static::$queries, 'string', null), true), + 'duplicate' => in_array($queryString, array_column(static::$queries, 'string'), true), 'trace' => $backtrace, ]; } diff --git a/system/Model.php b/system/Model.php index 60759b9e201f..0a51b4820872 100644 --- a/system/Model.php +++ b/system/Model.php @@ -195,7 +195,7 @@ protected function doFind(bool $singleton, $id = null) } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField, null); + $builder->where($this->table . '.' . $this->deletedField); } $row = null; @@ -279,7 +279,7 @@ protected function doFindAll(?int $limit = null, int $offset = 0) } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField, null); + $builder->where($this->table . '.' . $this->deletedField); } $results = $builder->limit($limit, $offset) @@ -316,7 +316,7 @@ protected function doFirst() } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField, null); + $builder->where($this->table . '.' . $this->deletedField); } elseif ($this->useSoftDeletes && ($builder->QBGroupBy === []) && $this->primaryKey !== '') { $builder->groupBy($this->table . '.' . $this->primaryKey); } @@ -662,7 +662,7 @@ public function chunk(int $size, Closure $userFunc) public function countAllResults(bool $reset = true, bool $test = false) { if ($this->tempUseSoftDeletes) { - $this->builder()->where($this->table . '.' . $this->deletedField, null); + $this->builder()->where($this->table . '.' . $this->deletedField); } // When $reset === false, the $tempUseSoftDeletes will be diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index b1f6275ba60f..c3b974448e43 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -228,7 +228,7 @@ public function call(string $method, string $path, ?array $params = null) ->run($routes, true); // Reset directory if it has been set - service('router')->setDirectory(null); + service('router')->setDirectory(); return new TestResponse($response); } diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 77b8b7b16465..bc09ef6e9f57 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -801,7 +801,7 @@ public function testIsWindowsUsingMock(): void $this->assertFalse(is_windows()); $this->assertNotTrue(is_windows()); - is_windows(null); + is_windows(); $this->assertSame(str_contains(php_uname(), 'Windows'), is_windows()); $this->assertSame(defined('PHP_WINDOWS_VERSION_MAJOR'), is_windows()); } diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 250474cbc0ea..d7d55fc3d8b1 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -163,13 +163,13 @@ public function testNewImage(): void public function testNewNegotiatorWithNullConfig(): void { - $actual = Services::negotiator(null); + $actual = Services::negotiator(); $this->assertInstanceOf(Negotiate::class, $actual); } public function testNewClirequest(): void { - $actual = Services::clirequest(null); + $actual = Services::clirequest(); $this->assertInstanceOf(CLIRequest::class, $actual); } @@ -201,7 +201,7 @@ public function testNewUnsharedLanguage(): void public function testNewPager(): void { - $actual = Services::pager(null); + $actual = Services::pager(); $this->assertInstanceOf(Pager::class, $actual); } @@ -225,13 +225,13 @@ public function testNewToolbar(): void public function testNewUri(): void { - $actual = Services::uri(null); + $actual = Services::uri(); $this->assertInstanceOf(URI::class, $actual); } public function testNewValidation(): void { - $actual = Services::validation(null); + $actual = Services::validation(); $this->assertInstanceOf(Validation::class, $actual); } diff --git a/tests/system/Database/Builder/UpdateTest.php b/tests/system/Database/Builder/UpdateTest.php index eb1cfc7d9c92..7409a3ee56ab 100644 --- a/tests/system/Database/Builder/UpdateTest.php +++ b/tests/system/Database/Builder/UpdateTest.php @@ -43,7 +43,7 @@ public function testUpdateArray(): void $builder = new BaseBuilder('jobs', $this->db); $data = ['name' => 'Programmer']; - $builder->testMode()->where('id', 1)->update($data, null, null); + $builder->testMode()->where('id', 1)->update($data); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -66,7 +66,7 @@ public function testUpdateObject(): void $builder = new BaseBuilder('jobs', $this->db); $data = (object) ['name' => 'Programmer']; - $builder->testMode()->where('id', 1)->update($data, null, null); + $builder->testMode()->where('id', 1)->update($data); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -110,7 +110,7 @@ public function testUpdateWithSet(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('name', 'Programmer')->where('id', 1)->update(null, null, null); + $builder->testMode()->set('name', 'Programmer')->where('id', 1)->update(); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -132,7 +132,7 @@ public function testUpdateWithSetAsInt(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('age', 22)->where('id', 1)->update(null, null, null); + $builder->testMode()->set('age', 22)->where('id', 1)->update(); $expectedSQL = 'UPDATE "jobs" SET "age" = 22 WHERE "id" = 1'; $expectedBinds = [ @@ -154,7 +154,7 @@ public function testUpdateWithSetAsBoolean(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('manager', true)->where('id', 1)->update(null, null, null); + $builder->testMode()->set('manager', true)->where('id', 1)->update(); $expectedSQL = 'UPDATE "jobs" SET "manager" = 1 WHERE "id" = 1'; $expectedBinds = [ @@ -176,7 +176,7 @@ public function testUpdateWithSetAsArray(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update(null, null, null); + $builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update(); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\', "age" = 22, "manager" = 1 WHERE "id" = 1'; $expectedBinds = [ @@ -209,7 +209,7 @@ public function testUpdateThrowsExceptionWithNoData(): void $this->expectException(DatabaseException::class); $this->expectExceptionMessage('You must use the "set" method to update an entry.'); - $builder->update(null, null, null); + $builder->update(); } public function testUpdateBatch(): void @@ -319,7 +319,7 @@ public function testUpdateBatchThrowsExceptionWithNoID(): void ], ]; - $builder->updateBatch($set, null); + $builder->updateBatch($set); } public function testUpdateBatchThrowsExceptionWithEmptySetArray(): void @@ -336,7 +336,7 @@ public function testUpdateWithWhereSameColumn(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer'], null); + $builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer']); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -361,8 +361,7 @@ public function testUpdateWithWhereSameColumn2(): void $builder->testMode() ->set('name', 'foobar') - ->where('name', 'Programmer') - ->update(null, null, null); + ->where('name', 'Programmer')->update(); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -387,7 +386,7 @@ public function testUpdateWithWhereSameColumn3(): void $builder->testMode() ->where('name', 'Programmer') - ->update(['name' => 'foobar'], null, null); + ->update(['name' => 'foobar']); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -414,8 +413,7 @@ public function testSetWithoutEscape(): void $builder->testMode() ->set('field', 'field+1', false) - ->where('id', 2) - ->update(null, null, null); + ->where('id', 2)->update(); $expectedSQL = 'UPDATE "mytable" SET "field" = field+1 WHERE "id" = 2'; $expectedBinds = [ @@ -436,8 +434,7 @@ public function testSetWithAndWithoutEscape(): void $builder->testMode() ->set('foo', 'bar') ->set('field', 'field+1', false) - ->where('id', 2) - ->update(null, null, null); + ->where('id', 2)->update(); $expectedSQL = 'UPDATE "mytable" SET "foo" = \'bar\', "field" = field+1 WHERE "id" = 2'; $expectedBinds = [ diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index 2d0c2a3e1233..8807076fee4a 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -512,7 +512,7 @@ public function testOrWhereInSubQuery(): void // Closure $builder = $this->db->table('jobs'); - $builder->where('deleted_at', null)->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); + $builder->where('deleted_at')->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); @@ -523,7 +523,7 @@ public function testOrWhereInSubQuery(): void ->select('job_id') ->where('user_id', 3); - $builder->where('deleted_at', null)->orWhereIn('id', $subQuery); + $builder->where('deleted_at')->orWhereIn('id', $subQuery); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } @@ -560,7 +560,7 @@ public function testOrWhereNotInSubQuery(): void // Closure $builder = $this->db->table('jobs'); - $builder->where('deleted_at', null)->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); + $builder->where('deleted_at')->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); @@ -571,7 +571,7 @@ public function testOrWhereNotInSubQuery(): void ->select('job_id') ->where('user_id', 3); - $builder->where('deleted_at', null)->orWhereNotIn('id', $subQuery); + $builder->where('deleted_at')->orWhereNotIn('id', $subQuery); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } @@ -692,7 +692,7 @@ public function testWhereValueIsNull(): void { $builder = $this->db->table('users'); - $builder->where('id', null); + $builder->where('id'); $expectedSQL = 'SELECT * FROM "users" WHERE "id" IS NULL'; $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); diff --git a/tests/system/Database/Live/WhereTest.php b/tests/system/Database/Live/WhereTest.php index 8513144356cf..79e4d24a6397 100644 --- a/tests/system/Database/Live/WhereTest.php +++ b/tests/system/Database/Live/WhereTest.php @@ -178,7 +178,7 @@ public function testWhereNullParam(): void ]); $jobs = $this->db->table('job') - ->where('description', null) + ->where('description') ->get() ->getResult(); diff --git a/tests/system/Database/Live/WriteTypeQueryTest.php b/tests/system/Database/Live/WriteTypeQueryTest.php index faaa7bfabddb..5881b0ca5d44 100644 --- a/tests/system/Database/Live/WriteTypeQueryTest.php +++ b/tests/system/Database/Live/WriteTypeQueryTest.php @@ -142,7 +142,7 @@ public function testInsertWithMultiReturning(): void public function testUpdateBuilder(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->where('id', 1)->update(['name' => 'Programmer'], null, null); + $builder->testMode()->where('id', 1)->update(['name' => 'Programmer']); $sql = $builder->getCompiledInsert(); $this->assertTrue($this->db->isWriteType($sql)); diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index 99ee23708780..b7a1eff0e150 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -126,7 +126,7 @@ public function testHeaderAppendsValueSkippedForNull(): void $header = new Header($name, $value); - $header->appendValue(null); + $header->appendValue(); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValue()); @@ -158,7 +158,7 @@ public function testHeaderPrependsValueSkippedForNull(): void $header = new Header($name, $value); - $header->prependValue(null); + $header->prependValue(); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValue()); @@ -204,7 +204,7 @@ public function testHeaderSetValueWithNullWillMarkAsEmptyString(): void $expected = ''; $header = new Header($name); - $header->setValue('bar')->setValue(null); + $header->setValue('bar')->setValue(); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValueLine()); diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index 1240d0885b23..dbbe82bee0ed 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -491,7 +491,7 @@ public function testGetVarWorksWithJsonAndGetParams(): void $_REQUEST['foo'] = 'bar'; $_REQUEST['fizz'] = 'buzz'; - $request = $this->createRequest($config, null); + $request = $this->createRequest($config); $request = $request->withMethod('GET'); // JSON type diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index ec0d3ded0dc2..fe2b2a73978c 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -54,7 +54,7 @@ public function testNowSpecific(): void public function testTimezoneSelectDefault(): void { - $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL, null); + $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL); $expected = "\n"; diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index f6dc0d7d3149..b8c1dff4678b 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -384,7 +384,7 @@ public function testBaseURLService(): void ); $this->assertSame( 'http://example.com/ci/v4/controller/method', - base_url('controller/method', null), + base_url('controller/method'), ); } @@ -402,7 +402,7 @@ public function testBaseURLWithCLIRequest(): void ); $this->assertSame( 'http://example.com/controller/method', - base_url('controller/method', null), + base_url('controller/method'), ); } @@ -456,7 +456,7 @@ public function testBaseURLWithAllowedHostname(): void $this->assertSame( 'http://www.example.jp/public/controller/method', - base_url('controller/method', null), + base_url('controller/method'), ); } } diff --git a/tests/system/Models/CountAllModelTest.php b/tests/system/Models/CountAllModelTest.php index f91a97c1b309..d333faf25731 100644 --- a/tests/system/Models/CountAllModelTest.php +++ b/tests/system/Models/CountAllModelTest.php @@ -63,7 +63,7 @@ public function testcountAllResultsFalseWithDeletedTrue(): void public function testcountAllResultsFalseWithDeletedFalse(): void { $builder = $this->loadBuilder('user'); - $expectedSQL = $builder->testMode()->where('user.deleted_at', null)->countAllResults(); + $expectedSQL = $builder->testMode()->where('user.deleted_at')->countAllResults(); $this->createModel(UserModel::class); $this->model->delete(1); @@ -96,7 +96,7 @@ public function testcountAllResultsFalseWithDeletedTrueUseSoftDeletesFalse(): vo public function testcountAllResultsFalseWithDeletedFalseUseSoftDeletesFalse(): void { $builder = $this->loadBuilder('user'); - $expectedSQL = $builder->testMode()->where('user.deleted_at', null)->countAllResults(); + $expectedSQL = $builder->testMode()->where('user.deleted_at')->countAllResults(); $this->createModel(UserModel::class); $this->model->delete(1); diff --git a/tests/system/Test/FabricatorTest.php b/tests/system/Test/FabricatorTest.php index 041dea518485..46ab9441dd74 100644 --- a/tests/system/Test/FabricatorTest.php +++ b/tests/system/Test/FabricatorTest.php @@ -78,7 +78,7 @@ public function testConstructorSetsFormatters(): void public function testConstructorGuessesFormatters(): void { - $fabricator = new Fabricator(UserModel::class, null); + $fabricator = new Fabricator(UserModel::class); $this->assertSame($this->formatters, $fabricator->getFormatters()); } From 4f61cb4cf2020ee4911cea6132a96071cd27281d Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 1 Nov 2025 00:02:50 +0700 Subject: [PATCH 3/4] Revert "refactor: re-run rector to remove null arg on default null param" This reverts commit 308bdebf7f2ef6d010db5b459e4978b5c75c0912. --- system/Debug/Toolbar/Collectors/Database.php | 2 +- system/Model.php | 8 ++--- system/Test/FeatureTestTrait.php | 2 +- tests/system/CommonFunctionsTest.php | 2 +- tests/system/Config/ServicesTest.php | 10 +++---- tests/system/Database/Builder/UpdateTest.php | 29 ++++++++++--------- tests/system/Database/Builder/WhereTest.php | 10 +++---- tests/system/Database/Live/WhereTest.php | 2 +- .../Database/Live/WriteTypeQueryTest.php | 2 +- tests/system/HTTP/HeaderTest.php | 6 ++-- tests/system/HTTP/IncomingRequestTest.php | 2 +- tests/system/Helpers/DateHelperTest.php | 4 +-- .../system/Helpers/URLHelper/SiteUrlTest.php | 6 ++-- tests/system/Models/CountAllModelTest.php | 4 +-- tests/system/Test/FabricatorTest.php | 2 +- 15 files changed, 47 insertions(+), 44 deletions(-) diff --git a/system/Debug/Toolbar/Collectors/Database.php b/system/Debug/Toolbar/Collectors/Database.php index be57931b30f9..482c9fbcdf0f 100644 --- a/system/Debug/Toolbar/Collectors/Database.php +++ b/system/Debug/Toolbar/Collectors/Database.php @@ -104,7 +104,7 @@ public static function collect(Query $query) static::$queries[] = [ 'query' => $query, 'string' => $queryString, - 'duplicate' => in_array($queryString, array_column(static::$queries, 'string'), true), + 'duplicate' => in_array($queryString, array_column(static::$queries, 'string', null), true), 'trace' => $backtrace, ]; } diff --git a/system/Model.php b/system/Model.php index 0a51b4820872..60759b9e201f 100644 --- a/system/Model.php +++ b/system/Model.php @@ -195,7 +195,7 @@ protected function doFind(bool $singleton, $id = null) } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField); + $builder->where($this->table . '.' . $this->deletedField, null); } $row = null; @@ -279,7 +279,7 @@ protected function doFindAll(?int $limit = null, int $offset = 0) } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField); + $builder->where($this->table . '.' . $this->deletedField, null); } $results = $builder->limit($limit, $offset) @@ -316,7 +316,7 @@ protected function doFirst() } if ($this->tempUseSoftDeletes) { - $builder->where($this->table . '.' . $this->deletedField); + $builder->where($this->table . '.' . $this->deletedField, null); } elseif ($this->useSoftDeletes && ($builder->QBGroupBy === []) && $this->primaryKey !== '') { $builder->groupBy($this->table . '.' . $this->primaryKey); } @@ -662,7 +662,7 @@ public function chunk(int $size, Closure $userFunc) public function countAllResults(bool $reset = true, bool $test = false) { if ($this->tempUseSoftDeletes) { - $this->builder()->where($this->table . '.' . $this->deletedField); + $this->builder()->where($this->table . '.' . $this->deletedField, null); } // When $reset === false, the $tempUseSoftDeletes will be diff --git a/system/Test/FeatureTestTrait.php b/system/Test/FeatureTestTrait.php index c3b974448e43..b1f6275ba60f 100644 --- a/system/Test/FeatureTestTrait.php +++ b/system/Test/FeatureTestTrait.php @@ -228,7 +228,7 @@ public function call(string $method, string $path, ?array $params = null) ->run($routes, true); // Reset directory if it has been set - service('router')->setDirectory(); + service('router')->setDirectory(null); return new TestResponse($response); } diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index bc09ef6e9f57..77b8b7b16465 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -801,7 +801,7 @@ public function testIsWindowsUsingMock(): void $this->assertFalse(is_windows()); $this->assertNotTrue(is_windows()); - is_windows(); + is_windows(null); $this->assertSame(str_contains(php_uname(), 'Windows'), is_windows()); $this->assertSame(defined('PHP_WINDOWS_VERSION_MAJOR'), is_windows()); } diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index d7d55fc3d8b1..250474cbc0ea 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -163,13 +163,13 @@ public function testNewImage(): void public function testNewNegotiatorWithNullConfig(): void { - $actual = Services::negotiator(); + $actual = Services::negotiator(null); $this->assertInstanceOf(Negotiate::class, $actual); } public function testNewClirequest(): void { - $actual = Services::clirequest(); + $actual = Services::clirequest(null); $this->assertInstanceOf(CLIRequest::class, $actual); } @@ -201,7 +201,7 @@ public function testNewUnsharedLanguage(): void public function testNewPager(): void { - $actual = Services::pager(); + $actual = Services::pager(null); $this->assertInstanceOf(Pager::class, $actual); } @@ -225,13 +225,13 @@ public function testNewToolbar(): void public function testNewUri(): void { - $actual = Services::uri(); + $actual = Services::uri(null); $this->assertInstanceOf(URI::class, $actual); } public function testNewValidation(): void { - $actual = Services::validation(); + $actual = Services::validation(null); $this->assertInstanceOf(Validation::class, $actual); } diff --git a/tests/system/Database/Builder/UpdateTest.php b/tests/system/Database/Builder/UpdateTest.php index 7409a3ee56ab..eb1cfc7d9c92 100644 --- a/tests/system/Database/Builder/UpdateTest.php +++ b/tests/system/Database/Builder/UpdateTest.php @@ -43,7 +43,7 @@ public function testUpdateArray(): void $builder = new BaseBuilder('jobs', $this->db); $data = ['name' => 'Programmer']; - $builder->testMode()->where('id', 1)->update($data); + $builder->testMode()->where('id', 1)->update($data, null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -66,7 +66,7 @@ public function testUpdateObject(): void $builder = new BaseBuilder('jobs', $this->db); $data = (object) ['name' => 'Programmer']; - $builder->testMode()->where('id', 1)->update($data); + $builder->testMode()->where('id', 1)->update($data, null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -110,7 +110,7 @@ public function testUpdateWithSet(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('name', 'Programmer')->where('id', 1)->update(); + $builder->testMode()->set('name', 'Programmer')->where('id', 1)->update(null, null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1'; $expectedBinds = [ @@ -132,7 +132,7 @@ public function testUpdateWithSetAsInt(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('age', 22)->where('id', 1)->update(); + $builder->testMode()->set('age', 22)->where('id', 1)->update(null, null, null); $expectedSQL = 'UPDATE "jobs" SET "age" = 22 WHERE "id" = 1'; $expectedBinds = [ @@ -154,7 +154,7 @@ public function testUpdateWithSetAsBoolean(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set('manager', true)->where('id', 1)->update(); + $builder->testMode()->set('manager', true)->where('id', 1)->update(null, null, null); $expectedSQL = 'UPDATE "jobs" SET "manager" = 1 WHERE "id" = 1'; $expectedBinds = [ @@ -176,7 +176,7 @@ public function testUpdateWithSetAsArray(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update(); + $builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update(null, null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\', "age" = 22, "manager" = 1 WHERE "id" = 1'; $expectedBinds = [ @@ -209,7 +209,7 @@ public function testUpdateThrowsExceptionWithNoData(): void $this->expectException(DatabaseException::class); $this->expectExceptionMessage('You must use the "set" method to update an entry.'); - $builder->update(); + $builder->update(null, null, null); } public function testUpdateBatch(): void @@ -319,7 +319,7 @@ public function testUpdateBatchThrowsExceptionWithNoID(): void ], ]; - $builder->updateBatch($set); + $builder->updateBatch($set, null); } public function testUpdateBatchThrowsExceptionWithEmptySetArray(): void @@ -336,7 +336,7 @@ public function testUpdateWithWhereSameColumn(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer']); + $builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer'], null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -361,7 +361,8 @@ public function testUpdateWithWhereSameColumn2(): void $builder->testMode() ->set('name', 'foobar') - ->where('name', 'Programmer')->update(); + ->where('name', 'Programmer') + ->update(null, null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -386,7 +387,7 @@ public function testUpdateWithWhereSameColumn3(): void $builder->testMode() ->where('name', 'Programmer') - ->update(['name' => 'foobar']); + ->update(['name' => 'foobar'], null, null); $expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\''; $expectedBinds = [ @@ -413,7 +414,8 @@ public function testSetWithoutEscape(): void $builder->testMode() ->set('field', 'field+1', false) - ->where('id', 2)->update(); + ->where('id', 2) + ->update(null, null, null); $expectedSQL = 'UPDATE "mytable" SET "field" = field+1 WHERE "id" = 2'; $expectedBinds = [ @@ -434,7 +436,8 @@ public function testSetWithAndWithoutEscape(): void $builder->testMode() ->set('foo', 'bar') ->set('field', 'field+1', false) - ->where('id', 2)->update(); + ->where('id', 2) + ->update(null, null, null); $expectedSQL = 'UPDATE "mytable" SET "foo" = \'bar\', "field" = field+1 WHERE "id" = 2'; $expectedBinds = [ diff --git a/tests/system/Database/Builder/WhereTest.php b/tests/system/Database/Builder/WhereTest.php index 8807076fee4a..2d0c2a3e1233 100644 --- a/tests/system/Database/Builder/WhereTest.php +++ b/tests/system/Database/Builder/WhereTest.php @@ -512,7 +512,7 @@ public function testOrWhereInSubQuery(): void // Closure $builder = $this->db->table('jobs'); - $builder->where('deleted_at')->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); + $builder->where('deleted_at', null)->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); @@ -523,7 +523,7 @@ public function testOrWhereInSubQuery(): void ->select('job_id') ->where('user_id', 3); - $builder->where('deleted_at')->orWhereIn('id', $subQuery); + $builder->where('deleted_at', null)->orWhereIn('id', $subQuery); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } @@ -560,7 +560,7 @@ public function testOrWhereNotInSubQuery(): void // Closure $builder = $this->db->table('jobs'); - $builder->where('deleted_at')->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); + $builder->where('deleted_at', null)->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3)); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); @@ -571,7 +571,7 @@ public function testOrWhereNotInSubQuery(): void ->select('job_id') ->where('user_id', 3); - $builder->where('deleted_at')->orWhereNotIn('id', $subQuery); + $builder->where('deleted_at', null)->orWhereNotIn('id', $subQuery); $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); } @@ -692,7 +692,7 @@ public function testWhereValueIsNull(): void { $builder = $this->db->table('users'); - $builder->where('id'); + $builder->where('id', null); $expectedSQL = 'SELECT * FROM "users" WHERE "id" IS NULL'; $this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect())); diff --git a/tests/system/Database/Live/WhereTest.php b/tests/system/Database/Live/WhereTest.php index 79e4d24a6397..8513144356cf 100644 --- a/tests/system/Database/Live/WhereTest.php +++ b/tests/system/Database/Live/WhereTest.php @@ -178,7 +178,7 @@ public function testWhereNullParam(): void ]); $jobs = $this->db->table('job') - ->where('description') + ->where('description', null) ->get() ->getResult(); diff --git a/tests/system/Database/Live/WriteTypeQueryTest.php b/tests/system/Database/Live/WriteTypeQueryTest.php index 5881b0ca5d44..faaa7bfabddb 100644 --- a/tests/system/Database/Live/WriteTypeQueryTest.php +++ b/tests/system/Database/Live/WriteTypeQueryTest.php @@ -142,7 +142,7 @@ public function testInsertWithMultiReturning(): void public function testUpdateBuilder(): void { $builder = new BaseBuilder('jobs', $this->db); - $builder->testMode()->where('id', 1)->update(['name' => 'Programmer']); + $builder->testMode()->where('id', 1)->update(['name' => 'Programmer'], null, null); $sql = $builder->getCompiledInsert(); $this->assertTrue($this->db->isWriteType($sql)); diff --git a/tests/system/HTTP/HeaderTest.php b/tests/system/HTTP/HeaderTest.php index b7a1eff0e150..99ee23708780 100644 --- a/tests/system/HTTP/HeaderTest.php +++ b/tests/system/HTTP/HeaderTest.php @@ -126,7 +126,7 @@ public function testHeaderAppendsValueSkippedForNull(): void $header = new Header($name, $value); - $header->appendValue(); + $header->appendValue(null); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValue()); @@ -158,7 +158,7 @@ public function testHeaderPrependsValueSkippedForNull(): void $header = new Header($name, $value); - $header->prependValue(); + $header->prependValue(null); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValue()); @@ -204,7 +204,7 @@ public function testHeaderSetValueWithNullWillMarkAsEmptyString(): void $expected = ''; $header = new Header($name); - $header->setValue('bar')->setValue(); + $header->setValue('bar')->setValue(null); $this->assertSame($name, $header->getName()); $this->assertSame($expected, $header->getValueLine()); diff --git a/tests/system/HTTP/IncomingRequestTest.php b/tests/system/HTTP/IncomingRequestTest.php index dbbe82bee0ed..1240d0885b23 100644 --- a/tests/system/HTTP/IncomingRequestTest.php +++ b/tests/system/HTTP/IncomingRequestTest.php @@ -491,7 +491,7 @@ public function testGetVarWorksWithJsonAndGetParams(): void $_REQUEST['foo'] = 'bar'; $_REQUEST['fizz'] = 'buzz'; - $request = $this->createRequest($config); + $request = $this->createRequest($config, null); $request = $request->withMethod('GET'); // JSON type diff --git a/tests/system/Helpers/DateHelperTest.php b/tests/system/Helpers/DateHelperTest.php index fe2b2a73978c..ec0d3ded0dc2 100644 --- a/tests/system/Helpers/DateHelperTest.php +++ b/tests/system/Helpers/DateHelperTest.php @@ -54,7 +54,7 @@ public function testNowSpecific(): void public function testTimezoneSelectDefault(): void { - $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL); + $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL, null); $expected = "\n"; diff --git a/tests/system/Helpers/URLHelper/SiteUrlTest.php b/tests/system/Helpers/URLHelper/SiteUrlTest.php index b8c1dff4678b..f6dc0d7d3149 100644 --- a/tests/system/Helpers/URLHelper/SiteUrlTest.php +++ b/tests/system/Helpers/URLHelper/SiteUrlTest.php @@ -384,7 +384,7 @@ public function testBaseURLService(): void ); $this->assertSame( 'http://example.com/ci/v4/controller/method', - base_url('controller/method'), + base_url('controller/method', null), ); } @@ -402,7 +402,7 @@ public function testBaseURLWithCLIRequest(): void ); $this->assertSame( 'http://example.com/controller/method', - base_url('controller/method'), + base_url('controller/method', null), ); } @@ -456,7 +456,7 @@ public function testBaseURLWithAllowedHostname(): void $this->assertSame( 'http://www.example.jp/public/controller/method', - base_url('controller/method'), + base_url('controller/method', null), ); } } diff --git a/tests/system/Models/CountAllModelTest.php b/tests/system/Models/CountAllModelTest.php index d333faf25731..f91a97c1b309 100644 --- a/tests/system/Models/CountAllModelTest.php +++ b/tests/system/Models/CountAllModelTest.php @@ -63,7 +63,7 @@ public function testcountAllResultsFalseWithDeletedTrue(): void public function testcountAllResultsFalseWithDeletedFalse(): void { $builder = $this->loadBuilder('user'); - $expectedSQL = $builder->testMode()->where('user.deleted_at')->countAllResults(); + $expectedSQL = $builder->testMode()->where('user.deleted_at', null)->countAllResults(); $this->createModel(UserModel::class); $this->model->delete(1); @@ -96,7 +96,7 @@ public function testcountAllResultsFalseWithDeletedTrueUseSoftDeletesFalse(): vo public function testcountAllResultsFalseWithDeletedFalseUseSoftDeletesFalse(): void { $builder = $this->loadBuilder('user'); - $expectedSQL = $builder->testMode()->where('user.deleted_at')->countAllResults(); + $expectedSQL = $builder->testMode()->where('user.deleted_at', null)->countAllResults(); $this->createModel(UserModel::class); $this->model->delete(1); diff --git a/tests/system/Test/FabricatorTest.php b/tests/system/Test/FabricatorTest.php index 46ab9441dd74..041dea518485 100644 --- a/tests/system/Test/FabricatorTest.php +++ b/tests/system/Test/FabricatorTest.php @@ -78,7 +78,7 @@ public function testConstructorSetsFormatters(): void public function testConstructorGuessesFormatters(): void { - $fabricator = new Fabricator(UserModel::class); + $fabricator = new Fabricator(UserModel::class, null); $this->assertSame($this->formatters, $fabricator->getFormatters()); } From f35bc5a7183b093db94acd14be6bf4baaf5423a8 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 1 Nov 2025 00:03:15 +0700 Subject: [PATCH 4/4] chore: skip RemoveNullArgOnNullDefaultParamRector --- rector.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rector.php b/rector.php index 9f7092f53451..d45394aee966 100644 --- a/rector.php +++ b/rector.php @@ -25,6 +25,7 @@ use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector; +use Rector\DeadCode\Rector\MethodCall\RemoveNullArgOnNullDefaultParamRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; @@ -183,6 +184,8 @@ DeclareStrictTypesTestsRector::class => [ __DIR__ . '/tests/system/Debug/ExceptionsTest.php', ], + + RemoveNullArgOnNullDefaultParamRector::class, ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true)