qandidate-labs/broadway — pull request #38 by Miliooo (2014-09-05 22:37:09+00:00)
Title: CommandBusCommandAware

:crying_cat_face:

This fixes the fact that the current code doesn't care what data it receives. See [CommandBusInterface](https://github.com/qandidate-labs/broadway/blob/master/src/Broadway/CommandHandling/CommandBusInterface.php)

I think most would expect to see
```
public function dispatch(CommandInterface $command)
```
The problem is that it doesn't even force you to send objects, the argument is mixed.
So you can send
- strings (caused endless loop [link](https://github.com/qandidate-labs/broadway/pull/35)
- array of commands
- event objects
- your mother

The argument less coupling seems very silly to me. This is just making the code really fragile.
But the beauty of OOP is that there are things like the Open Closed Principle. So I used the adapter pattern to workaround this.

This is my nerdy attempt to start a discussion about this. And it offers an alternative if you really don't want to enforce that commands are objects by letting them implement an empty interface.

CommandBusCommandAwareInterface would for me indicate a code smell though.