Completed
Pull Request — master (#9)
by Vytautas
10:39 queued 07:17
created

TransformersManagerFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
namespace SvImages\Transformer\Factory;
3
4
use Psr\Container\ContainerInterface;
5
use SvImages\Transformer\TransformersManager;
6
use SvImages\Options\ModuleOptions;
7
8
/**
9
 * @author Vytautas Stankus <[email protected]>
10
 * @license MIT
11
 */
12
class TransformersManagerFactory
13
{
14
    public function __invoke(ContainerInterface $container)
15
    {
16
        /** @var ModuleOptions $options */
17
        $options = $container->get(ModuleOptions::class);
18
19
        return new TransformersManager($container, $options->getTransformers());
0 ignored issues
show
Documentation introduced by
$container is of type object<Psr\Container\ContainerInterface>, but the function expects a null|object<Zend\Service...ner\ContainerInterface>.

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