diff --git a/composer.json b/composer.json index 055621d..3e05a88 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7.2 || ^8.0", "event-engine/php-schema": "^0.3.0", - "event-engine/php-engine-utils": "^0.2.1", + "event-engine/php-engine-utils": "^0.2.1 || ^1.0", "ramsey/uuid" : "^3.6|^4.0" }, "require-dev": { diff --git a/src/CommandDispatchResult.php b/src/CommandDispatchResult.php index d6bcf6d..794c022 100644 --- a/src/CommandDispatchResult.php +++ b/src/CommandDispatchResult.php @@ -43,7 +43,7 @@ public static function forCommandHandledByController(Message $dispatedCommand): return new self($dispatedCommand); } - private function __construct(Message $dispatchedCommand, string $effectedAggregateId = null, Message ...$recordedEvents) + private function __construct(Message $dispatchedCommand, ?string $effectedAggregateId = null, Message ...$recordedEvents) { $this->dispatchedCommand = $dispatchedCommand; $this->effectedAggregateId = $effectedAggregateId; diff --git a/src/Exception/MessageNotFound.php b/src/Exception/MessageNotFound.php index b382111..f924283 100644 --- a/src/Exception/MessageNotFound.php +++ b/src/Exception/MessageNotFound.php @@ -20,7 +20,7 @@ public static function withMessageName(string $messageName): self return new self("Unknown message $messageName"); } - public function __construct(string $message = "", Throwable $previous = null) + public function __construct(string $message = "", ?Throwable $previous = null) { parent::__construct($message, 404, $previous); } diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index fb843c1..0f0b224 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -15,7 +15,7 @@ class RuntimeException extends \RuntimeException implements MessagingException { - public function __construct(string $message = "", Throwable $previous = null) + public function __construct(string $message = "", ?Throwable $previous = null) { parent::__construct($message, 500, $previous); } diff --git a/src/MessageBag.php b/src/MessageBag.php index e683664..6f0078a 100644 --- a/src/MessageBag.php +++ b/src/MessageBag.php @@ -77,7 +77,7 @@ final class MessageBag implements Message * @param \DateTimeImmutable|null $createdAt * @throws \Exception */ - public function __construct(string $messageName, string $messageType, $message, $metadata = [], UuidInterface $messageId = null, \DateTimeImmutable $createdAt = null) + public function __construct(string $messageName, string $messageType, $message, $metadata = [], ?UuidInterface $messageId = null, ?\DateTimeImmutable $createdAt = null) { if (! \in_array($messageType, self::MSG_TYPES)) { throw new \InvalidArgumentException('Message type should be one of ' . \implode(', ', self::MSG_TYPES) . ". Got $messageType");