Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

AdminList/UserAdminListConfigurator.php (5 issues)

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\UserManagementBundle\AdminList;
4
5
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\BooleanFilterType;
6
use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType;
7
8
/**
9
 * User admin list configurator used to manage {@link User} in the admin
10
 */
11
class UserAdminListConfigurator extends AbstractSettingsAdminListConfigurator
12
{
13
    /**
14
     * Build filters for admin list
15
     */
16
    public function buildFilters()
17
    {
18
        $this->addFilter('username', new StringFilterType('username'), 'kuma_user.users.adminlist.filter.username');
19
        $this->addFilter('email', new StringFilterType('email'), 'kuma_user.users.adminlist.filter.email');
20
        $this->addFilter('enabled', new BooleanFilterType('enabled'), 'kuma_user.users.adminlist.filter.enabled');
21
    }
22
23
    /**
24
     * Configure the visible columns
25
     */
26
    public function buildFields()
27
    {
28
        $this->addField('username', 'kuma_user.users.adminlist.header.username', 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...
29
        $this->addField('email', 'kuma_user.users.adminlist.header.email', 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...
30
        $this->addField('enabled', 'kuma_user.users.adminlist.header.enabled', 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...
31
        $this->addField('lastLogin', 'kuma_user.users.adminlist.header.last_login', false);
0 ignored issues
show
false 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...
32
        $this->addField('groups', 'kuma_user.users.adminlist.header.groups', false);
0 ignored issues
show
false 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...
33
    }
34
35
    /**
36
     * Override path convention (because settings is a virtual admin subtree)
37
     *
38
     * @param string $suffix
39
     *
40
     * @return string
41
     */
42
    public function getPathByConvention($suffix = null)
43
    {
44
        return 'KunstmaanUserManagementBundle_settings_users' . (empty($suffix) ? '' : '_' . $suffix);
45
    }
46
47
    /**
48
     * Get entity name
49
     *
50
     * @return string
51
     */
52
    public function getEntityName()
53
    {
54
        return 'User';
55
    }
56
}
57