From 8782a5baaffd8e88316e40738273a018d50f94cc Mon Sep 17 00:00:00 2001 From: Pavel Buchnev Date: Thu, 30 Nov 2023 12:33:57 +0400 Subject: [PATCH] Add Psalm annotations to query and command buses to provide type information for return values (#15) --- src/CommandBusInterface.php | 6 ++++++ src/CommandInterface.php | 3 +++ src/QueryBusInterface.php | 6 ++++++ src/QueryInterface.php | 3 +++ 4 files changed, 18 insertions(+) diff --git a/src/CommandBusInterface.php b/src/CommandBusInterface.php index eaac8a6..2ff11db 100644 --- a/src/CommandBusInterface.php +++ b/src/CommandBusInterface.php @@ -6,5 +6,11 @@ interface CommandBusInterface { + /** + * @template TResult + * @param CommandInterface $command + * + * @return TResult + */ public function dispatch(CommandInterface $command): mixed; } diff --git a/src/CommandInterface.php b/src/CommandInterface.php index dc9ad77..a783894 100644 --- a/src/CommandInterface.php +++ b/src/CommandInterface.php @@ -4,6 +4,9 @@ namespace Spiral\Cqrs; +/** + * @template TResult + */ interface CommandInterface { diff --git a/src/QueryBusInterface.php b/src/QueryBusInterface.php index e9bf762..c5a52cb 100644 --- a/src/QueryBusInterface.php +++ b/src/QueryBusInterface.php @@ -6,5 +6,11 @@ interface QueryBusInterface { + /** + * @template TResult + * @param QueryInterface $query + * + * @return TResult + */ public function ask(QueryInterface $query): mixed; } diff --git a/src/QueryInterface.php b/src/QueryInterface.php index 2d983a7..445fc45 100644 --- a/src/QueryInterface.php +++ b/src/QueryInterface.php @@ -4,6 +4,9 @@ namespace Spiral\Cqrs; +/** + * @template TResult + */ interface QueryInterface {