@@ -103,7 +103,7 @@ |
||
| 103 | 103 | */ |
| 104 | 104 | private function ensureEventsAreMessages(array $events): array |
| 105 | 105 | { |
| 106 | - return array_map(function (object $event) { |
|
| 106 | + return array_map(function(object $event) { |
|
| 107 | 107 | return $event instanceof Message ? $event : new Message($event); |
| 108 | 108 | }, $events); |
| 109 | 109 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $lastMessage = null; |
| 48 | 48 | |
| 49 | 49 | foreach ($this->messages as $message) { |
| 50 | - if ($id->toString() === $message->aggregateRootId()?->toString()) { |
|
| 50 | + if ($id->toString() === $message->aggregateRootId() ? ->toString()) { |
|
| 51 | 51 | yield $message; |
| 52 | 52 | $lastMessage = $message; |
| 53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $lastMessage = null; |
| 62 | 62 | |
| 63 | 63 | foreach ($this->messages as $message) { |
| 64 | - if ($id->toString() === $message->aggregateRootId()?->toString() |
|
| 64 | + if ($id->toString() === $message->aggregateRootId() ? ->toString() |
|
| 65 | 65 | && $message->header(Header::AGGREGATE_ROOT_VERSION) > $aggregateRootVersion) { |
| 66 | 66 | yield $message; |
| 67 | 67 | $lastMessage = $message; |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | // of recording. |
| 81 | 81 | $aggregateRootVersion = $aggregateRootVersion - count($events); |
| 82 | 82 | $metadata = [Header::AGGREGATE_ROOT_ID => $aggregateRootId]; |
| 83 | - $messages = array_map(fn (object $event) => $this->decorator->decorate(new Message( |
|
| 83 | + $messages = array_map(fn(object $event) => $this->decorator->decorate(new Message( |
|
| 84 | 84 | $event, |
| 85 | 85 | $metadata + [Header::AGGREGATE_ROOT_VERSION => ++$aggregateRootVersion] |
| 86 | 86 | )), $events); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function withHeader(string $key, int|string|null|AggregateRootId $value): Message |
|
| 20 | + public function withHeader(string $key, int | string | null | AggregateRootId $value): Message |
|
| 21 | 21 | { |
| 22 | 22 | $clone = clone $this; |
| 23 | 23 | $clone->headers[$key] = $value; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | return $timeOfRecording; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function header(string $key): int|string|array|AggregateRootId|null |
|
| 74 | + public function header(string $key): int | string | array | AggregateRootId | null |
|
| 75 | 75 | { |
| 76 | 76 | return $this->headers[$key] ?? null; |
| 77 | 77 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | protected function eventRecorder(): EventRecorder |
| 25 | 25 | { |
| 26 | 26 | if (null === $this->eventRecorder) { |
| 27 | - $this->eventRecorder = new EventRecorder(fn (object $event) => $this->recordThat($event)); |
|
| 27 | + $this->eventRecorder = new EventRecorder(fn(object $event) => $this->recordThat($event)); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return $this->eventRecorder; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function dispatch(Message ...$messages): void |
| 14 | 14 | { |
| 15 | 15 | $this->dispatcher->dispatch( |
| 16 | - ...array_map(fn (Message $message) => $this->decorator->decorate($message), $messages) |
|
| 16 | + ...array_map(fn(Message $message) => $this->decorator->decorate($message), $messages) |
|
| 17 | 17 | ); |
| 18 | 18 | } |
| 19 | 19 | } |