diff --git a/src/Shared/Infrastructure/Bus/Event/RabbitMq/RabbitMqDomainEventsConsumer.php b/src/Shared/Infrastructure/Bus/Event/RabbitMq/RabbitMqDomainEventsConsumer.php index bf12fc093..c6afe08e1 100644 --- a/src/Shared/Infrastructure/Bus/Event/RabbitMq/RabbitMqDomainEventsConsumer.php +++ b/src/Shared/Infrastructure/Bus/Event/RabbitMq/RabbitMqDomainEventsConsumer.php @@ -7,6 +7,7 @@ use AMQPEnvelope; use AMQPQueue; use AMQPQueueException; +use CodelyTv\Shared\Domain\Bus\Event\DomainEventSubscriber; use CodelyTv\Shared\Infrastructure\Bus\Event\DomainEventJsonDeserializer; use Throwable; @@ -22,7 +23,7 @@ public function __construct( private int $maxRetries ) {} - public function consume(callable $subscriber, string $queueName): void + public function consume(callable|DomainEventSubscriber $subscriber, string $queueName): void { try { $this->connection->queue($queueName)->consume($this->consumer($subscriber)); diff --git a/src/Shared/Infrastructure/Bus/Query/InMemorySymfonyQueryBus.php b/src/Shared/Infrastructure/Bus/Query/InMemorySymfonyQueryBus.php index d01b9e105..e08643fcd 100644 --- a/src/Shared/Infrastructure/Bus/Query/InMemorySymfonyQueryBus.php +++ b/src/Shared/Infrastructure/Bus/Query/InMemorySymfonyQueryBus.php @@ -14,9 +14,9 @@ use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware; use Symfony\Component\Messenger\Stamp\HandledStamp; -final class InMemorySymfonyQueryBus implements QueryBus +final readonly class InMemorySymfonyQueryBus implements QueryBus { - private readonly MessageBus $bus; + private MessageBus $bus; public function __construct(iterable $queryHandlers) { diff --git a/tests/Shared/Infrastructure/PhpUnit/UnitTestCase.php b/tests/Shared/Infrastructure/PhpUnit/UnitTestCase.php index 54d0e3a45..02c7d3116 100644 --- a/tests/Shared/Infrastructure/PhpUnit/UnitTestCase.php +++ b/tests/Shared/Infrastructure/PhpUnit/UnitTestCase.php @@ -78,6 +78,7 @@ protected function assertAskResponse(Response $expected, Query $query, callable $this->assertEquals($expected, $actual); } + /** @param class-string<\Throwable> $expectedErrorClass */ protected function assertAskThrowsException(string $expectedErrorClass, Query $query, callable $queryHandler): void { $this->expectException($expectedErrorClass);