Makes json expectation usable in Higher Order Tests

This commit is contained in:
Luke Downing
2022-01-23 23:10:14 +00:00
parent d2ca6e630d
commit ead2dfd0a9
3 changed files with 27 additions and 2 deletions

View File

@ -62,7 +62,7 @@ final class Expectation
/**
* Creates a new expectation with the decoded JSON value.
*
* @return self<mixed>
* @return self<array<int|string, mixed>|bool>
*/
public function json(): Expectation
{
@ -70,7 +70,10 @@ final class Expectation
InvalidExpectationValue::expected('string');
}
return $this->toBeJson()->and(json_decode($this->value, true));
/** @var array<int|string, mixed>|bool $value */
$value = json_decode($this->value, true);
return $this->toBeJson()->and($value);
}
/**