1 | <?php |
||
12 | class UserHydrator implements HydratorInterface |
||
13 | { |
||
14 | /** @var HydratorInterface */ |
||
15 | private $hydrator; |
||
16 | |||
17 | /** |
||
18 | * UserHydrator constructor. |
||
19 | * |
||
20 | * @param HydratorInterface $hydrator |
||
21 | */ |
||
22 | public function __construct(HydratorInterface $hydrator) |
||
26 | |||
27 | /** |
||
28 | * Extract values from an object |
||
29 | * |
||
30 | * @param UserEntityInterface $object |
||
31 | * @return array |
||
32 | * @throws Exception\InvalidArgumentException |
||
33 | */ |
||
34 | public function extract($object): array |
||
49 | |||
50 | /** |
||
51 | * Hydrate $object with the provided $data. |
||
52 | * |
||
53 | * @param array $data |
||
54 | * @param UserEntityInterface $object |
||
55 | * @return UserInterface |
||
56 | * @throws Exception\InvalidArgumentException |
||
57 | */ |
||
58 | public function hydrate(array $data, $object) |
||
68 | |||
69 | /** |
||
70 | * @param string $keyFrom |
||
71 | * @param string $keyTo |
||
72 | * @param array $array |
||
73 | * @return array |
||
74 | */ |
||
75 | protected function mapField($keyFrom, $keyTo, array $array) |
||
82 | } |
||
83 |
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: