| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 17 | final class ProdVndErrorPage extends ResourceObject |
||
| 18 | { |
||
| 19 | public function __construct(Throwable $e, RouterMatch $request) |
||
| 20 | { |
||
| 21 | unset($request); |
||
| 22 | $status = new Status($e); |
||
| 23 | $this->code = $status->code; |
||
| 24 | $this->headers = $this->getHeader($status->code); |
||
|
|
|||
| 25 | $this->body = $this->getResponseBody($e, $status); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function toString(): string |
||
| 33 | } |
||
| 34 | |||
| 35 | /** @return array<string, string> */ |
||
| 36 | private function getHeader(int $code): array |
||
| 37 | { |
||
| 38 | return ['content-type' => $code >= 500 ? 'application/vnd.error+json' : 'application/json']; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** @return array<string, string> */ |
||
| 42 | private function getResponseBody(Throwable $e, Status $status): array |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
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..