Completed
Branch master (3aeee0)
by Toni
04:47 queued 01:43
created

Module.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 * This file is part of the Adlogix package.
4
 *
5
 * (c) Allan Segebarth <[email protected]>
6
 * (c) Jean-Jacques Courtens <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Adlogix\Zf2Rollout;
13
14
15
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
16
use Zend\ModuleManager\Feature\ConfigProviderInterface;
17
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
18
use Zend\ServiceManager\AbstractPluginManager;
19
20
class Module implements AutoloaderProviderInterface, ConfigProviderInterface, ViewHelperProviderInterface
21
{
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function getAutoloaderConfig()
27
    {
28
        return array(
29
            'Zend\Loader\StandardAutoloader' => array(
30
                'namespaces' => array(
31
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
32
                ),
33
            ),
34
        );
35
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getConfig()
42
    {
43
        return include __DIR__ . '/config/module.config.php';
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getViewHelperConfig()
50
    {
51
        return [
52
            'factories' => [
53
                'rollout_is_active' => function (AbstractPluginManager $pluginManager) {
54
                    $serviceLocator = $pluginManager->getServiceLocator();
55
                    $rollout = $serviceLocator->get('zf2_rollout');
56
                    return new View\Helper\IsActive($rollout);
0 ignored issues
show
$rollout is of type object|array, but the function expects a object<Opensoft\Rollout\Rollout>.

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...
57
                }
58
            ],
59
        ];
60
    }
61
}