Merge pull request #1017 from markhuot/patch-2

[2.x] Add `toSnapshot` early return
This commit is contained in:
Nuno Maduro
2023-11-29 08:50:28 +00:00
committed by GitHub
3 changed files with 24 additions and 0 deletions

View File

@ -844,6 +844,7 @@ final class Expectation
$string = match (true) {
is_string($this->value) => $this->value,
is_object($this->value) && method_exists($this->value, 'toSnapshot') => $this->value->toSnapshot(),
is_object($this->value) && method_exists($this->value, '__toString') => $this->value->__toString(),
is_object($this->value) && method_exists($this->value, 'toString') => $this->value->toString(),
$this->value instanceof \Illuminate\Testing\TestResponse => $this->value->getContent(), // @phpstan-ignore-line