Completed
Push — master ( a54a4b...bbfdca )
by Adam
15:54
created

Bundle/AppBundle/Twig/QuickLoginExtension.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
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
namespace WellCommerce\Bundle\AppBundle\Twig;
13
14
use WellCommerce\Bundle\CoreBundle\Helper\Router\RouterHelperInterface;
15
use WellCommerce\Component\Form\FormBuilderInterface;
16
17
/**
18
 * Class QuickLoginExtension
19
 *
20
 * @author  Adam Piotrowski <[email protected]>
21
 */
22
final class QuickLoginExtension extends \Twig_Extension
23
{
24
    /**
25
     * @var FormBuilderInterface
26
     */
27
    private $builder;
28
29
    /**
30
     * @var RouterHelperInterface
31
     */
32
    private $routerHelper;
33
34
    /**
35
     * QuickLoginExtension constructor.
36
     *
37
     * @param FormBuilderInterface  $builder
38
     * @param RouterHelperInterface $routerHelper
39
     */
40
    public function __construct(FormBuilderInterface $builder, RouterHelperInterface $routerHelper)
41
    {
42
        $this->builder      = $builder;
43
        $this->routerHelper = $routerHelper;
44
    }
45
    
46
    public function getFunctions()
47
    {
48
        return [
49
            new \Twig_SimpleFunction('quick_login_form', [$this, 'createQuickLoginForm'], ['is_safe' => ['html']]),
50
        ];
51
    }
52
53
    public function getName()
54
    {
55
        return 'quick_login_form';
56
    }
57
58
    public function createQuickLoginForm()
59
    {
60
        return $this->builder->createForm([
61
            'name'         => 'login',
62
            'ajax_enabled' => false,
63
            'action'       => $this->routerHelper->generateUrl('front.client.login_check')
64
        ], null);
0 ignored issues
show
null is of type null, but the function expects a array.

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...
65
    }
66
}
67