Completed
Push — develop ( 23366e...787284 )
by
unknown
13s
created

ManagerFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
namespace Organizations\Factory\ImageFileCache;
10
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
use Organizations\ImageFileCache\Manager;
14
15
/**
16
 * @author Miroslav Fedeleš <[email protected]>
17
 * @since 0.28
18
 */
19
class ManagerFactory implements FactoryInterface
20
{
21
    /**
22
     * {@inheritDoc}
23
     * @see \Zend\ServiceManager\FactoryInterface::createService()
24
     */
25
    public function createService(ServiceLocatorInterface $serviceLocator)
26
    {
27
        return new Manager($serviceLocator->get('Organizations/ImageFileCacheOptions'));
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('Or...ImageFileCacheOptions') is of type object|array, but the function expects a object<Organizations\Opt...\ImageFileCacheOptions>.

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...
28
    }
29
}
30