1 | <?php |
||
25 | trait EventSourcedAggregateRoot |
||
26 | { |
||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $version; |
||
31 | |||
32 | /** |
||
33 | * @var DomainEventInterface[] |
||
34 | */ |
||
35 | protected $recordedEvents = []; |
||
36 | |||
37 | /** |
||
38 | * @param DomainEventInterface $event |
||
39 | */ |
||
40 | protected function recordApplyAndPublishEvent(DomainEventInterface $event) |
||
51 | |||
52 | /** |
||
53 | * @param DomainEventInterface $event |
||
54 | */ |
||
55 | protected function applyEvent(DomainEventInterface $event) |
||
69 | |||
70 | /** |
||
71 | * @param DomainEventInterface $event |
||
72 | */ |
||
73 | protected function publishEvent(DomainEventInterface $event) |
||
77 | |||
78 | /** |
||
79 | * @param DomainEventInterface $event |
||
80 | */ |
||
81 | protected function recordEvent(DomainEventInterface $event) |
||
85 | |||
86 | /** |
||
87 | * @return DomainEventInterface[] |
||
88 | */ |
||
89 | public function recordedEvents() |
||
93 | |||
94 | /** |
||
95 | * Clear recorded events. |
||
96 | */ |
||
97 | public function clearEvents() |
||
101 | |||
102 | /** |
||
103 | * @param EventStream $history |
||
104 | * |
||
105 | * @return AggregateRootInterface |
||
106 | */ |
||
107 | public static function loadFromHistory(EventStream $history) |
||
118 | |||
119 | /** |
||
120 | * @param EventStream $history |
||
121 | */ |
||
122 | public function replay(EventStream $history) |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | public function version() |
||
140 | |||
141 | /** |
||
142 | * Increment the current version. |
||
143 | */ |
||
144 | protected function incrementVersion() |
||
151 | |||
152 | /** |
||
153 | * {@inheritdoc} |
||
154 | */ |
||
155 | public function setVersion($version) |
||
159 | } |
||
160 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: