Test Failed
Push — master ( 17aae5...cb6d8d )
by Daniel
02:30 queued 39s
created

src/Renderer/JsonRenderer.php (1 issue)

1
<?php
2
3
namespace App\Renderer;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
final class JsonRenderer
8
{
9
    public function json(
10
        ResponseInterface $response,
11
        mixed $data = null,
12
    ): ResponseInterface {
13
        $response = $response->withHeader('Content-Type', 'application/json');
14
15
        $response->getBody()->write(
16
            (string)json_encode(
17
                $data,
18
                JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR
19
            )
20
        );
21
22
        return $response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response returns the type Psr\Http\Message\MessageInterface which includes types incompatible with the type-hinted return Psr\Http\Message\ResponseInterface.
Loading history...
23
    }
24
}
25