diff --git a/src/actions/RenderCompiledClasses.php b/src/actions/RenderCompiledClasses.php index 0ecc7ba..0844624 100644 --- a/src/actions/RenderCompiledClasses.php +++ b/src/actions/RenderCompiledClasses.php @@ -53,7 +53,7 @@ protected function render(bool $forceRecreate) file_put_contents($compiledClassPath, $compiledClass); } - protected function cleanupOldMixins(string $except = null) + protected function cleanupOldMixins(?string $except = null) { $compiledClassesPath = __DIR__.'/../storage/'; diff --git a/src/behaviors/TestableResponseBehavior.php b/src/behaviors/TestableResponseBehavior.php index 6e33bdf..97e2c87 100644 --- a/src/behaviors/TestableResponseBehavior.php +++ b/src/behaviors/TestableResponseBehavior.php @@ -181,7 +181,7 @@ public function querySelector(string $selector) * * To submit the form use `->submit()` or `->click('.button-selector')`. */ - public function form(string $selector = null): Form + public function form(?string $selector = null): Form { if ($selector === null) { if ($this->form) { @@ -240,7 +240,7 @@ public function assertCacheTag(string ...$tags) * $response->assertCookie('cookieName', 'cookie value'); // checks that the values match * ``` */ - public function assertCookie(string $name, string $value = null) + public function assertCookie(string $name, ?string $value = null) { if ($value === null) { Assert::assertContains($name, array_keys($this->response->cookies->toArray())); @@ -360,7 +360,7 @@ public function assertDontSeeText(string $text) * $response->assertDownload('file.jpg'); // checks that a download with the name `file.jpg` is returned * ``` */ - public function assertDownload(string $filename = null) + public function assertDownload(?string $filename = null) { $contentDisposition = explode(';', $this->response->headers->get('content-disposition')); @@ -438,7 +438,7 @@ public function assertForbidden() * $response->assertHeader('x-foo', 'bar'); // checks for header with matching value * ``` */ - public function assertHeader(string $name, string $expected = null) + public function assertHeader(string $name, ?string $expected = null) { if ($expected === null) { Assert::assertContains($name, array_keys($this->response->headers->toArray())); @@ -488,7 +488,7 @@ public function assertJson(array|callable $value, $strict = false) return $this->response; } - public function assertJsonCount(int $count, string $key = null) + public function assertJsonCount(int $count, ?string $key = null) { $this->getJsonContent()->assertCount($count, $key); @@ -535,7 +535,7 @@ public function assertJsonMissingPath(string $path) return $this->response; } - public function assertJsonStructure(array $structure = null, $responseData = null) + public function assertJsonStructure(?array $structure = null, $responseData = null) { $this->getJsonContent()->assertStructure($structure, $responseData); @@ -564,7 +564,7 @@ public function assertJsonValidationErrors() * $response->assertLocation('/foo', ['host', 'path']); * ``` */ - public function assertLocation(string $location, array $checkParts = null) + public function assertLocation(string $location, ?array $checkParts = null) { $header = $this->response->getHeaders()->get('Location'); $headerParts = parse_url($header); @@ -612,7 +612,7 @@ public function assertLocationPath(string $uri) * $response->assertFlash('Field is required', 'title'); * ``` */ - public function assertFlash(string $message = null, string $key = null) + public function assertFlash(?string $message = null, ?string $key = null) { $flash = \Craft::$app->getSession()->getAllFlashes(); diff --git a/src/craft/services/ProjectConfig.php b/src/craft/services/ProjectConfig.php index be07e96..8985b11 100644 --- a/src/craft/services/ProjectConfig.php +++ b/src/craft/services/ProjectConfig.php @@ -4,7 +4,7 @@ class ProjectConfig extends \markhuot\craftpest\overrides\ProjectConfig { - public function saveModifiedConfigData(bool $writeExternalConfig = null): void + public function saveModifiedConfigData(?bool $writeExternalConfig = null): void { // no-op since we don't ever want to save config data back to the DB in a test } diff --git a/src/http/RequestBuilder.php b/src/http/RequestBuilder.php index b4d9bba..9296c4e 100644 --- a/src/http/RequestBuilder.php +++ b/src/http/RequestBuilder.php @@ -26,8 +26,8 @@ class RequestBuilder public function __construct( string $method, string $uri, - \craft\web\Application $app = null, - RequestHandler $handler = null, + ?\craft\web\Application $app = null, + ?RequestHandler $handler = null, ) { $this->method = $method; $this->app = $app ?? \Craft::$app; diff --git a/src/http/RequestHandler.php b/src/http/RequestHandler.php index dcd55e2..439b08f 100644 --- a/src/http/RequestHandler.php +++ b/src/http/RequestHandler.php @@ -14,7 +14,7 @@ class RequestHandler { private \craft\web\Application $app; - public function __construct(\craft\web\Application $app = null) + public function __construct(?\craft\web\Application $app = null) { $this->app = $app ?? \Craft::$app; } diff --git a/src/illuminate/AssertableJsonString.php b/src/illuminate/AssertableJsonString.php index 309d317..b802494 100644 --- a/src/illuminate/AssertableJsonString.php +++ b/src/illuminate/AssertableJsonString.php @@ -246,7 +246,7 @@ public function assertPath($path, $expect) * @param array|null $responseData * @return $this */ - public function assertStructure(array $structure = null, $responseData = null) + public function assertStructure(?array $structure = null, $responseData = null) { if (is_null($structure)) { return $this->assertSimilar($this->decoded); diff --git a/src/test/ActingAs.php b/src/test/ActingAs.php index f8a3695..2f8cdd4 100644 --- a/src/test/ActingAs.php +++ b/src/test/ActingAs.php @@ -23,7 +23,7 @@ trait ActingAs * 4. A callable that returns a User element, `->actingAs(fn () => $someUser)` * 5. `null` to log the user out for the given request */ - public function actingAs(UserFactory|User|string|callable $userOrName = null): self + public function actingAs(UserFactory|User|string|callable|null $userOrName = null): self { if (is_null($userOrName)) { \Craft::$app->getUser()->logout(false);