Skip to content

Commit 8359de7

Browse files
committed
Use Stringable whenever possible
1 parent 581574f commit 8359de7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

JsonResponse.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(mixed $data = null, int $status = 200, array $header
4040
{
4141
parent::__construct('', $status, $headers);
4242

43-
if ($json && !\is_string($data) && !is_numeric($data) && !\is_callable([$data, '__toString'])) {
43+
if ($json && !\is_string($data) && !is_numeric($data) && !$data instanceof \Stringable) {
4444
throw new \TypeError(\sprintf('"%s": If $json is set to true, argument $data must be a string or object implementing __toString(), "%s" given.', __METHOD__, get_debug_type($data)));
4545
}
4646

0 commit comments

Comments
 (0)