Completed
Push — master ( 047b73...cb7aa6 )
by Robbie
11s
created

QueuedJobsAdminExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateEditForm() 0 14 2
1
<?php
2
3
class QueuedJobsAdminExtension extends Extension
4
{
5
    /**
6
     * Add a configurable paginator
7
     *
8
     * @param Form $form
9
     */
10
    public function updateEditForm(Form $form)
11
    {
12
        /** @var GridField $gridField */
13
        $gridField = $form->Fields()->fieldByName('QueuedJobDescriptor');
14
        if (!$gridField) {
15
            return;
16
        }
17
18
        $gridField->getConfig()
19
            ->removeComponentsByType(GridFieldPaginator::class)
20
            ->addComponent(
21
                new GridFieldConfigurablePaginator(50, [50, 100, 200, 500])
0 ignored issues
show
Documentation introduced by
array(50, 100, 200, 500) is of type array<integer,integer,{"...nteger","3":"integer"}>, but the function expects a integer|null.

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...
22
            );
23
    }
24
}
25