diff --git a/rector.php b/rector.php index d45394aee966..04de84b4ef81 100644 --- a/rector.php +++ b/rector.php @@ -185,7 +185,12 @@ __DIR__ . '/tests/system/Debug/ExceptionsTest.php', ], - RemoveNullArgOnNullDefaultParamRector::class, + RemoveNullArgOnNullDefaultParamRector::class => [ + // skip form query usage, easier to read + __DIR__ . '/system/Model.php', + __DIR__ . '/tests/system/Database', + __DIR__ . '/tests/system/Models', + ], ]) // auto import fully qualified class names ->withImportNames(removeUnusedImports: true) 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/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/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 c6a693b7681c..419e661c8fe1 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/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()); }