1 | <?php |
||
12 | final class Repository |
||
13 | { |
||
14 | /** @var $entityClass */ |
||
15 | private $entityClass; |
||
16 | |||
17 | /** @var EventStore $eventStore */ |
||
18 | private $eventStore; |
||
19 | |||
20 | /** |
||
21 | * @param EventSourcedEntity $class |
||
22 | * @param EventStore $eventStore |
||
23 | */ |
||
24 | private function __construct($class, EventStore $eventStore) |
||
29 | |||
30 | /** |
||
31 | * @param $class |
||
32 | * @param EventStore $eventStore |
||
33 | * @return Repository |
||
34 | */ |
||
35 | public static function createForType($class, EventStore $eventStore) |
||
39 | |||
40 | /** |
||
41 | * @param $key |
||
42 | * @return mixed |
||
43 | */ |
||
44 | public function load($key) |
||
54 | |||
55 | /** |
||
56 | * @param EventSourcedEntity $class |
||
57 | * @throws IncorrectEntityException |
||
58 | */ |
||
59 | public function save(EventSourcedEntity $class) |
||
64 | |||
65 | /** |
||
66 | * @param string $class |
||
67 | * @throws IncorrectEntityException |
||
68 | */ |
||
69 | private function enforceTypeConstraint($class) |
||
75 | } |
||
76 |
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: