ContainerAwareCommandBusFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 12 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\CommandBusBundle\Factory;
5
6
use Innmind\CommandBusBundle\ContainerAwareCommandBus;
7
use Innmind\Immutable\Map;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
10
final class ContainerAwareCommandBusFactory
11
{
12 3
    public static function make(
13
        ContainerInterface $container,
14
        array $services
15
    ): ContainerAwareCommandBus {
16 3
        $map = new Map('string', 'string');
17
18 3
        foreach ($services as $class => $service) {
19 3
            $map = $map->put($class, $service);
1 ignored issue
show
Documentation introduced by
$class is of type integer|string, but the function expects a object<Innmind\Immutable\T>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
20
        }
21
22 3
        return new ContainerAwareCommandBus($container, $map);
23
    }
24
}
25