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