Completed
Push — master ( 91fdab...75a7b9 )
by
unknown
13:37
created

AdminList/ExceptionAdminListConfigurator.php (5 issues)

mismatching argument types.

Documentation Minor

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
namespace Kunstmaan\AdminBundle\AdminList;
4
5
use Doctrine\ORM\EntityManager;
6
use Doctrine\ORM\QueryBuilder;
7
use Kunstmaan\AdminBundle\Entity\Exception;
8
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM;
9
use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper;
10
use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator;
11
use Kunstmaan\AdminListBundle\AdminList\ItemAction\SimpleItemAction;
12
use Kunstmaan\AdminListBundle\AdminList\ListAction\SimpleListAction;
13
14
class ExceptionAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator
15
{
16
    public function __construct(EntityManager $em, AclHelper $aclHelper = null)
17
    {
18
        parent::__construct($em, $aclHelper);
19
    }
20
21
    public function buildFields()
22
    {
23
        $this->addField('code', 'settings.exceptions.code', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

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
        $this->addField('url', 'settings.exceptions.url', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

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...
25
        $this->addField('urlReferer', 'settings.exceptions.urlReferer', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

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...
26
        $this->addField('events', 'settings.exceptions.events', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

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...
27
        $this->addField('createdAt', 'settings.exceptions.createdAt', true);
0 ignored issues
show
true is of type boolean, but the function expects a string.

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
    public function buildFilters()
31
    {
32
        $this->addFilter('code', new ORM\NumberFilterType('code'), 'settings.exceptions.code');
33
        $this->addFilter('url', new ORM\StringFilterType('url'), 'settings.exceptions.url');
34
        $this->addFilter('urlReferer', new ORM\StringFilterType('urlReferer'), 'settings.exceptions.urlReferer');
35
        $this->addFilter('isResolved', new ORM\BooleanFilterType('isResolved'), 'settings.exceptions.isResolved');
36
        $this->addFilter('createdAt', new ORM\DateFilterType('createdAt'), 'settings.exceptions.createdAt');
37
    }
38
39
    public function buildListActions()
40
    {
41
        $listRoute = [
42
            'path' => 'kunstmaanadminbundle_admin_exception_resolve_all',
43
            'params' => [],
44
       ];
45
46
        $this->addListAction(
47
            new SimpleListAction(
48
                $listRoute,
49
                'settings.exceptions.resolve_all',
50
                null,
51
                'KunstmaanAdminBundle:Settings:button_resolve_all.html.twig'
52
            )
53
        );
54
    }
55
56
    public function buildItemActions()
57
    {
58
        $this->addItemAction(
59
            new SimpleItemAction(
60
                function(Exception $row) {
61
                    return [
62
                        'path' => 'kunstmaanadminbundle_admin_exception_toggle_resolve',
63
                        'params' => [
64
                            'id' => $row->getId()
65
                        ]
66
                    ];
67
                },
68
                null,
69
                null,
70
                '@KunstmaanAdmin/Settings/button_resolve.html.twig'
71
            )
72
        );
73
    }
74
75
    public function finishQueryBuilder(QueryBuilder $queryBuilder)
76
    {
77
        $queryBuilder->orderBy('b.isResolved', 'ASC');
78
        $queryBuilder->addOrderBy('b.createdAt', 'DESC');
79
    }
80
81
    public function canAdd()
82
    {
83
        return false;
84
    }
85
86
    public function canExport()
87
    {
88
        return false;
89
    }
90
91
    public function canEdit($item)
92
    {
93
        return false;
94
    }
95
96
    public function canDelete($item)
97
    {
98
        return false;
99
    }
100
101
    public function canView($item)
102
    {
103
        return false;
104
    }
105
106
    public function getBundleName()
107
    {
108
        return 'KunstmaanAdminBundle';
109
    }
110
111
    public function getEntityName()
112
    {
113
        return 'Exception';
114
    }
115
116
}
117