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

Make AssertableJson easier to extend by replacing self with static #37380

Merged
merged 2 commits into from
May 17, 2021
Merged
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions src/Illuminate/Testing/Fluent/AssertableJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ protected function prop(string $key = null)
* @param \Closure $callback
* @return $this
*/
protected function scope(string $key, Closure $callback): self
protected function scope(string $key, Closure $callback): static
tontonsb marked this conversation as resolved.
Show resolved Hide resolved
{
$props = $this->prop($key);
$path = $this->dotPath($key);

PHPUnit::assertIsArray($props, sprintf('Property [%s] is not scopeable.', $path));

$scope = new self($props, $path);
$scope = new static($props, $path);
$callback($scope);
$scope->interacted();

Expand All @@ -99,7 +99,7 @@ protected function scope(string $key, Closure $callback): self
* @param \Closure $callback
* @return $this
*/
public function first(Closure $callback): self
public function first(Closure $callback): static
{
$props = $this->prop();

Expand All @@ -123,9 +123,9 @@ public function first(Closure $callback): self
* @param array $data
* @return static
*/
public static function fromArray(array $data): self
public static function fromArray(array $data): static
{
return new self($data);
return new static($data);
}

/**
Expand All @@ -134,9 +134,9 @@ public static function fromArray(array $data): self
* @param \Illuminate\Testing\AssertableJsonString $json
* @return static
*/
public static function fromAssertableJsonString(AssertableJsonString $json): self
public static function fromAssertableJsonString(AssertableJsonString $json): static
{
return self::fromArray($json->json());
return static::fromArray($json->json());
}

/**
Expand Down