| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 8 | ||
| Bugs | 3 | Features | 2 |
| 1 | <?php |
||
| 24 | public function transform(Rack $rack) |
||
| 25 | { |
||
| 26 | return [ |
||
| 27 | 'id' => (int) $rack->id, |
||
| 28 | 'name' => (string) $rack->name, |
||
| 29 | 'capacity' => (int) $rack->capacity, |
||
| 30 | 'used' => (int) $rack->used, |
||
| 31 | 'usage' => (float) $rack->usage, |
||
| 32 | 'make_id' => (int) $rack->make_id, |
||
| 33 | 'make' => [ |
||
| 34 | 'id' => (int) $rack->make->id, |
||
| 35 | 'name' => (string) $rack->make->name, |
||
| 36 | ], |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | |||
| 64 |
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: