MigrationFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 1 Features 2
Metric Value
c 5
b 1
f 2
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace T4web\Migrations\Service;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use T4web\Migrations\Version\Table;
8
use T4web\Migrations\Version\Resolver;
9
10
class MigrationFactory implements FactoryInterface
11
{
12
    public function createService(ServiceLocatorInterface $serviceLocator)
13
    {
14
        return new Migration(
15
            $serviceLocator->get(Resolver::class),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\T4...ersion\Resolver::class) is of type object|array, but the function expects a object<T4web\Migrations\Version\Resolver>.

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...
16
            $serviceLocator->get(Table::class),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\T4...s\Version\Table::class) is of type object|array, but the function expects a object<T4web\Migrations\Version\Table>.

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...
17
            $serviceLocator->get('console'),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('console') is of type object|array, but the function expects a object<Zend\Console\Adapter\Posix>.

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...
18
            $serviceLocator
19
        );
20
    }
21
}
22