| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public function make($command) |
||
| 12 | { |
||
| 13 | if (!class_exists($command)) { |
||
| 14 | throw CommandException::notFound($command); |
||
| 15 | } |
||
| 16 | |||
| 17 | $command = new $command; |
||
| 18 | |||
| 19 | if (!($command instanceof CommandInterface)) { |
||
| 20 | throw CommandException::invalidCommand($command); |
||
|
|
|||
| 21 | } |
||
| 22 | |||
| 23 | return $command; |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: