Completed
Pull Request — master (#176)
by Robbie
08:50 queued 07:19
created

QueuedJobsAdminExtension::updateEditForm()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
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