Skip to content

Commit

Permalink
Merge pull request #691 from JeppeKnockaert/fix-php84-deprecations
Browse files Browse the repository at this point in the history
Fix PHP 8.4 deprecations
  • Loading branch information
joetannenbaum authored Dec 5, 2024
2 parents c30424e + 55a26ae commit f6d3e16
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
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

0 comments on commit f6d3e16

Please sign in to comment.