Conditions | 2 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
20 | 12 | public function create(HttpResponseInterface $response): ResponseInterface |
|
21 | { |
||
22 | 12 | if ($response->getStatusCode() === 200) { |
|
23 | 4 | return new AuthorizationResponse($response, AuthorizationResponse::AUTHORISED); |
|
|
|||
24 | } |
||
25 | |||
26 | 8 | return new AuthorizationResponse($response, AuthorizationResponse::UNAUTHORISED); |
|
27 | } |
||
28 | } |
||
29 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.