| Total Complexity | 4 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class AbstractResponse |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The HTTP status code. |
||
| 11 | * |
||
| 12 | * @var int |
||
| 13 | */ |
||
| 14 | protected $status; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The errors on response. |
||
| 18 | * |
||
| 19 | * @var \SMartins\Exceptions\JsonApi\ErrorCollection |
||
| 20 | */ |
||
| 21 | protected $errors; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Create new JsonApi response passing the errors. |
||
| 25 | * |
||
| 26 | * @param \SMartins\Exceptions\JsonApi\ErrorCollection $errors |
||
| 27 | * |
||
| 28 | */ |
||
| 29 | public function __construct(ErrorHandledCollectionInterface $errors) |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Get the HTTP status code. |
||
| 38 | * |
||
| 39 | * @return int |
||
| 40 | */ |
||
| 41 | public function getStatus() |
||
| 42 | { |
||
| 43 | return $this->status; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Set the HTTP status code. |
||
| 48 | * |
||
| 49 | * @param int $status The HTTP status code. |
||
| 50 | * |
||
| 51 | * @return self |
||
| 52 | */ |
||
| 53 | public function setStatus(int $status) |
||
| 54 | { |
||
| 55 | $this->status = $status; |
||
| 56 | |||
| 57 | return $this; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get the errors on response. |
||
| 62 | * |
||
| 63 | * @return \SMartins\Exceptions\JsonApi\ErrorCollection |
||
| 64 | */ |
||
| 65 | public function getErrors() |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Returns JSON response. |
||
| 72 | * |
||
| 73 | * @return \Illuminate\Http\JsonResponse |
||
| 74 | */ |
||
| 75 | abstract public function json(): JsonResponse; |
||
| 76 | } |
||
| 77 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.