diff --git a/src/Domain/Model/AggregateRoot.php b/src/Domain/Model/AggregateRoot.php index e29f554..73ac300 100644 --- a/src/Domain/Model/AggregateRoot.php +++ b/src/Domain/Model/AggregateRoot.php @@ -18,7 +18,7 @@ final protected function __construct(Uuid $aggregateId, int $aggregateVersion = $this->aggregateVersion = $aggregateVersion; } - final public static function reconstitute(Uuid $id, DomainEvent ...$events): self + final public static function reconstitute(Uuid $id, DomainEvent ...$events): static { if (0 === \count($events)) { throw new \InvalidArgumentException('Can`t reconstitute without events'); diff --git a/src/Util/Message/AggregateMessage.php b/src/Util/Message/AggregateMessage.php index 7a08f21..5498ef4 100644 --- a/src/Util/Message/AggregateMessage.php +++ b/src/Util/Message/AggregateMessage.php @@ -33,7 +33,7 @@ final public static function fromPayload( DateTimeValueObject $occurredOn, array $payload, int $aggregateVersion = 0 - ): self { + ): static { $message = new static($messageId, $aggregateId, $aggregateVersion, $occurredOn, $payload); $message->assertPayload();