Skip to content

Commit

Permalink
Add Command typehint to Exception factories
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstuck committed Jan 3, 2015
1 parent 14a2181 commit 5a36cfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Exception/CanNotInvokeHandlerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Tactician\CommandBus\Exception;

use Tactician\CommandBus\Command;

/**
* Thrown when a specific handler object can not used on a command object.
*
Expand All @@ -11,11 +13,11 @@
class CanNotInvokeHandlerException extends \Exception
{
/**
* @param object $command
* @param Command $command
* @param string $reason
* @return static
*/
public static function onObject($command, $reason)
public static function onObject(Command $command, $reason)
{
return new static(
'Could not invoke handler for command ' . get_class($command) .
Expand Down
6 changes: 4 additions & 2 deletions src/Exception/MissingHandlerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

namespace Tactician\CommandBus\Exception;

use Tactician\CommandBus\Command;

/**
* No handler could be found for the given command.
*/
class MissingHandlerException extends \Exception
{
/**
* @param object $command
* @param Command $command
* @return static
*/
public static function forCommand($command)
public static function forCommand(Command $command)
{
return new static("Missing handler for command: ".get_class($command));
}
Expand Down

0 comments on commit 5a36cfe

Please sign in to comment.