These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace PhpGitHooks\Infrastructure\CommandBus\CommandBus; |
||
4 | |||
5 | use PhpGitHooks\Infrastructure\CommandBus\BusOptionsResolver; |
||
6 | use Symfony\Component\DependencyInjection\ContainerInterface; |
||
7 | |||
8 | View Code Duplication | class CommandBus |
|
9 | { |
||
10 | /** |
||
11 | * @var ContainerInterface |
||
12 | */ |
||
13 | private $container; |
||
14 | /** |
||
15 | * @var BusOptionsResolver |
||
16 | */ |
||
17 | private $optionsResolver; |
||
18 | |||
19 | /** |
||
20 | * CommandBus constructor. |
||
21 | * |
||
22 | * @param ContainerInterface $container |
||
23 | * @param BusOptionsResolver $optionsResolver |
||
24 | */ |
||
25 | public function __construct(ContainerInterface $container, BusOptionsResolver $optionsResolver) |
||
26 | { |
||
27 | $this->container = $container; |
||
28 | $this->optionsResolver = $optionsResolver; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param CommandInterface $command |
||
33 | */ |
||
34 | public function handle(CommandInterface $command) |
||
35 | { |
||
36 | $this->container->get($this->optionsResolver->getOption('\\'.get_class($command)))->handle($command); |
||
0 ignored issues
–
show
|
|||
37 | } |
||
38 | } |
||
39 |
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: