1 | <?php |
||
9 | class UpcasterStub implements DelegatableUpcaster |
||
10 | { |
||
11 | public function canUpcast(string $type, int $version): bool |
||
12 | { |
||
13 | return $this->type() === $type && $version < 1; |
||
14 | } |
||
15 | |||
16 | public function upcast(string $type, int $version, array $payload): Generator |
||
17 | { |
||
18 | $payload['data']['property'] = 'upcasted'; |
||
19 | $payload['version'] = 1; |
||
20 | |||
21 | yield $payload; |
||
22 | } |
||
23 | |||
24 | public function type(): string |
||
25 | { |
||
26 | return EventType::fromClassName(UpcastedEventStub::class)->toEventName(); |
||
27 | } |
||
28 | } |