| 1 | <?php |
||
| 8 | class WarehouseTransformer extends TransformerAbstract |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * List of resources possible to include. |
||
| 12 | * |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $availableIncludes = ['racks']; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Turn this item object into a generic array. |
||
| 19 | * |
||
| 20 | * @param Warehouse $warehouse |
||
| 21 | * |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | 1 | public function transform(Warehouse $warehouse) |
|
| 25 | { |
||
| 26 | return [ |
||
| 27 | 1 | 'id' => (int) $warehouse->id, |
|
| 28 | 1 | 'name' => (string) $warehouse->name, |
|
| 29 | 1 | ]; |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Includes addresses. |
||
| 34 | * |
||
| 35 | * @param Warehouse $warehouse |
||
| 36 | * |
||
| 37 | * @return \League\Fractal\Resource\Collection |
||
| 38 | */ |
||
| 39 | public function includeRacks(Warehouse $warehouse) |
||
| 43 | } |
||
| 44 |
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: