| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 19 | final class ProdVndErrorPage extends ResourceObject |
||
| 20 | { |
||
| 21 | public function __construct(Throwable $e, RouterMatch $request) |
||
| 28 | } |
||
| 29 | |||
| 30 | #[Override] |
||
| 31 | public function toString(): string |
||
| 32 | { |
||
| 33 | $jsonEncoded = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
||
| 34 | assert($jsonEncoded !== false); |
||
| 35 | $this->view = $jsonEncoded . PHP_EOL; |
||
| 36 | |||
| 37 | return $this->view; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** @return array<string, string> */ |
||
| 41 | private function getHeader(int $code): array |
||
| 42 | { |
||
| 43 | return ['content-type' => $code >= 500 ? 'application/vnd.error+json' : 'application/json']; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** @return array<string, string> */ |
||
| 47 | private function getResponseBody(Throwable $e, Status $status): array |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..