MigrationFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 1
c 5
b 1
f 2
lcom 0
cbo 2
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 9 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