Skip to content

Commit 5d2e689

Browse files
author
janvt
authored
feat: add generic/template support for queries/commands
2 parents db2f32f + 6d25a9c commit 5d2e689

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/Contracts/Application/Command.php

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace GeekCell\Ddd\Contracts\Application;
66

7+
/**
8+
* @template T of mixed
9+
*/
710
interface Command
811
{
912
}

src/Contracts/Application/CommandBus.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ interface CommandBus
99
/**
1010
* Dispatch a command to the appropriate handler.
1111
*
12-
* @param Command $command
13-
* @return mixed
12+
* @template T of mixed
13+
* @param Command<T> $command
14+
* @return T
1415
*/
1516
public function dispatch(Command $command): mixed;
1617
}

src/Contracts/Application/Query.php

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace GeekCell\Ddd\Contracts\Application;
66

7+
/**
8+
* @template T of mixed
9+
*/
710
interface Query
811
{
912
}

src/Contracts/Application/QueryBus.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ interface QueryBus
99
/**
1010
* Dispatch a query to the appropriate handler.
1111
*
12-
* @param Query $query
13-
* @return mixed
12+
* @template T of mixed
13+
* @param Query<T> $query
14+
* @return T
1415
*/
1516
public function dispatch(Query $query): mixed;
1617
}

0 commit comments

Comments
 (0)