| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 49 | protected function makeBody($pointHeaders, $data) |
||
| 50 | { |
||
| 51 | 12 | $apiHeaders = array_map(function ($value) { |
|
| 52 | 12 | return $value->get(); |
|
| 53 | 12 | }, $this->api->getHeaders()->get()); |
|
| 54 | |||
| 55 | 12 | $dataChain = $this->endpoint->getMethod() == 'GET' ? 'query' : 'json'; |
|
| 56 | 12 | $body = array_merge($apiHeaders, $pointHeaders); |
|
| 57 | 12 | $body[$dataChain] = $data; |
|
| 58 | |||
| 59 | 12 | $request = new Request($body, $this->endpoint->getTransformer('request'), $dataChain); |
|
| 60 | |||
| 61 | 12 | return $request->getBody($dataChain); |
|
| 62 | } |
||
| 63 | } |
||
| 64 |
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.