Refactoring to use toBeJson()

Refactoring according to @lukeraymonddowning suggestion
This commit is contained in:
Daniel Ang
2021-06-18 13:04:31 +02:00
parent c1b27579ca
commit ecb37fce91

View File

@ -65,10 +65,7 @@ final class Expectation
*/ */
public function json(): Expectation public function json(): Expectation
{ {
Assert::assertIsString($this->value); return $this->toBeJson()->and(json_decode($this->value, true));
Assert::assertJson($this->value);
return new self(json_decode($this->value, true));
} }
/** /**