| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 10 | public function multipleToAPIResponseData(?array $resources): APIResponseData |
|
| 27 | { |
||
| 28 | 10 | if(is_null($resources)) { |
|
| 29 | 2 | return $this->toAPIResponseData(null); |
|
| 30 | } |
||
| 31 | |||
| 32 | 8 | return new APIResponseData(array_map(function(Resource $resource) { |
|
| 33 | 7 | return $this->toAPIResponseData($resource)->getData(); |
|
|
1 ignored issue
–
show
|
|||
| 34 | 8 | }, $resources)); |
|
| 35 | } |
||
| 36 | } |
||
| 37 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: