Skip to content

Commit

Permalink
Add Psalm annotations to query and command buses to provide type info…
Browse files Browse the repository at this point in the history
…rmation for return values (#15)
  • Loading branch information
butschster authored Nov 30, 2023
1 parent 134c202 commit 8782a5b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/CommandBusInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@

interface CommandBusInterface
{
/**
* @template TResult
* @param CommandInterface<TResult> $command
*
* @return TResult
*/
public function dispatch(CommandInterface $command): mixed;
}
3 changes: 3 additions & 0 deletions src/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Spiral\Cqrs;

/**
* @template TResult
*/
interface CommandInterface
{

Expand Down
6 changes: 6 additions & 0 deletions src/QueryBusInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@

interface QueryBusInterface
{
/**
* @template TResult
* @param QueryInterface<TResult> $query
*
* @return TResult
*/
public function ask(QueryInterface $query): mixed;
}
3 changes: 3 additions & 0 deletions src/QueryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Spiral\Cqrs;

/**
* @template TResult
*/
interface QueryInterface
{

Expand Down

0 comments on commit 8782a5b

Please sign in to comment.