Completed
Push — develop ( 031ed9...9561de )
by
unknown
09:21
created

RemoveControllerFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @filesource
4
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
5
 * @license MIT
6
 * @author Miroslav Fedeleš <[email protected]>
7
 * @since 0.27
8
 */
9
namespace Auth\Factory\Controller;
10
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
class RemoveControllerFactory implements FactoryInterface
15
{
16
17
    /**
18
     * Create service
19
     *
20
     * @param ServiceLocatorInterface $serviceLocator
21
     *
22
     * @return UsersController
0 ignored issues
show
Documentation introduced by
Should the return type not be \Auth\Controller\RemoveController?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
23
     */
24
    public function createService(ServiceLocatorInterface $serviceLocator)
25
    {
26
        /* @var $serviceLocator ServiceLocatorInterface */
27
        $serviceLocator = $serviceLocator->getServiceLocator();
28
29
        return new \Auth\Controller\RemoveController($serviceLocator->get('Auth/Dependency/Manager'));
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('Auth/Dependency/Manager') is of type object|array, but the function expects a object<Auth\Dependency\Manager>.

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...
30
    }
31
}
32