Completed
Push — master ( 3c84e0...8482f5 )
by max
02:01
created

MigrationFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 1
Metric Value
c 4
b 1
f 1
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\MigrationVersion\Table;
8
9
class MigrationFactory implements FactoryInterface
10
{
11
12
    /**
13
     * Create service
14
     *
15
     * @param ServiceLocatorInterface $serviceLocator
16
     * @return mixed
17
     */
18
    public function createService(ServiceLocatorInterface $serviceLocator)
19
    {
20
        return new Migration(
21
            $serviceLocator->get(VersionResolver::class),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\T4...VersionResolver::class) is of type object|array, but the function expects a object<T4web\Migrations\Service\VersionResolver>.

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...
22
            $serviceLocator->get(Table::class),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\T4...onVersion\Table::class) is of type object|array, but the function expects a object<T4web\Migrations\MigrationVersion\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...
23
            $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...
24
            $serviceLocator
25
        );
26
    }
27
}
28