diff --git a/src/ResponseFactory.php b/src/ResponseFactory.php index 125667e9..0c336568 100644 --- a/src/ResponseFactory.php +++ b/src/ResponseFactory.php @@ -46,7 +46,7 @@ public function share($key, $value = null): void } } - public function getShared(string $key = null, $default = null) + public function getShared(?string $key = null, $default = null) { if ($key) { return Arr::get($this->sharedProps, $key, $default); diff --git a/src/Testing/AssertableInertia.php b/src/Testing/AssertableInertia.php index 370e748d..22abcbc3 100644 --- a/src/Testing/AssertableInertia.php +++ b/src/Testing/AssertableInertia.php @@ -42,7 +42,7 @@ public static function fromTestResponse(TestResponse $response): self return $instance; } - public function component(string $value = null, $shouldExist = null): self + public function component(?string $value = null, $shouldExist = null): self { PHPUnit::assertSame($value, $this->component, 'Unexpected Inertia page component.'); diff --git a/src/Testing/Concerns/Debugging.php b/src/Testing/Concerns/Debugging.php index 612374de..86a6269c 100644 --- a/src/Testing/Concerns/Debugging.php +++ b/src/Testing/Concerns/Debugging.php @@ -4,17 +4,17 @@ trait Debugging { - public function dump(string $prop = null): self + public function dump(?string $prop = null): self { dump($this->prop($prop)); return $this; } - public function dd(string $prop = null): void + public function dd(?string $prop = null): void { dd($this->prop($prop)); } - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); } diff --git a/src/Testing/Concerns/Has.php b/src/Testing/Concerns/Has.php index acfad9df..d181dae3 100644 --- a/src/Testing/Concerns/Has.php +++ b/src/Testing/Concerns/Has.php @@ -38,7 +38,7 @@ public function hasAll($key): self /** * @return $this */ - public function has(string $key, $value = null, Closure $scope = null): self + public function has(string $key, $value = null, ?Closure $scope = null): self { PHPUnit::assertTrue( Arr::has($this->prop(), $key), @@ -106,7 +106,7 @@ public function misses(string $key): self return $this->missing($key); } - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); abstract protected function dotPath(string $key): string; diff --git a/src/Testing/Concerns/Interaction.php b/src/Testing/Concerns/Interaction.php index 506d64d2..145d405e 100644 --- a/src/Testing/Concerns/Interaction.php +++ b/src/Testing/Concerns/Interaction.php @@ -37,5 +37,5 @@ public function etc(): self return $this; } - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); } diff --git a/src/Testing/Concerns/Matching.php b/src/Testing/Concerns/Matching.php index 6cb4404b..17f8d942 100644 --- a/src/Testing/Concerns/Matching.php +++ b/src/Testing/Concerns/Matching.php @@ -68,7 +68,7 @@ protected function ensureSorted(&$value): void abstract protected function dotPath(string $key): string; - abstract protected function prop(string $key = null); + abstract protected function prop(?string $key = null); - abstract public function has(string $key, $value = null, Closure $scope = null); + abstract public function has(string $key, $value = null, ?Closure $scope = null); } diff --git a/src/Testing/Concerns/PageObject.php b/src/Testing/Concerns/PageObject.php index 1dc98389..467c48c3 100644 --- a/src/Testing/Concerns/PageObject.php +++ b/src/Testing/Concerns/PageObject.php @@ -8,7 +8,7 @@ trait PageObject { - public function component(string $value = null, $shouldExist = null): self + public function component(?string $value = null, $shouldExist = null): self { PHPUnit::assertSame($value, $this->component, 'Unexpected Inertia page component.'); @@ -23,7 +23,7 @@ public function component(string $value = null, $shouldExist = null): self return $this; } - protected function prop(string $key = null) + protected function prop(?string $key = null) { return Arr::get($this->props, $key); } diff --git a/src/Testing/TestResponseMacros.php b/src/Testing/TestResponseMacros.php index a4ca6802..428dc2a6 100644 --- a/src/Testing/TestResponseMacros.php +++ b/src/Testing/TestResponseMacros.php @@ -8,7 +8,7 @@ class TestResponseMacros { public function assertInertia() { - return function (Closure $callback = null) { + return function (?Closure $callback = null) { $assert = AssertableInertia::fromTestResponse($this); if (is_null($callback)) {