Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP 8.4 deprecations #691

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/AssertableInertia.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');

Expand Down
6 changes: 3 additions & 3 deletions src/Testing/Concerns/Debugging.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions src/Testing/Concerns/Has.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Testing/Concerns/Interaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public function etc(): self
return $this;
}

abstract protected function prop(string $key = null);
abstract protected function prop(?string $key = null);
}
4 changes: 2 additions & 2 deletions src/Testing/Concerns/Matching.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions src/Testing/Concerns/PageObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');

Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/TestResponseMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down