Passed
Push — develop ( 355f63...51016a )
by Mathieu
02:23
created

DatagridAssociationField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 11
dl 0
loc 28
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\Annotation\Sonata;
6
7
use Attribute;
8
use Neimheadh\SonataAnnotationBundle\Annotation\AssociationFieldInterface;
9
use Neimheadh\SonataAnnotationBundle\Annotation\AssociationFieldTrait;
10
11
/**
12
 * Datagrid association field annotation.
13
 *
14
 * Allow you to configure the datagrid for the annotated field having
15
 * an association field.
16
 *
17
 * @Annotation
18
 * @Target("PROPERTY")
19
 *
20
 * @author Marko Kunic <[email protected]>
21
 * @author Mathieu Wambre <[email protected]>
22
 */
23
#[Attribute(Attribute::TARGET_PROPERTY)]
24
final class DatagridAssociationField extends DatagridField implements
25
    AssociationFieldInterface
26
{
27
28
    use AssociationFieldTrait;
29
30
    /**
31
     * {@inheritDoc}
32
     *
33
     * @param string|null $field Association field name.
34
     */
35
    public function __construct(
36
        $type = null,
37
        array $fieldDescriptionOptions = [],
38
        ?int $position = null,
39
        array $filterOptions = [],
40
        array $fieldOptions = [],
41
        ?string $field = null
42
    ) {
43
        $this->field = $field;
44
45
        parent::__construct(
46
            $type,
47
            $fieldDescriptionOptions,
48
            $position,
49
            $filterOptions,
0 ignored issues
show
Bug introduced by
$filterOptions of type array is incompatible with the type null|string expected by parameter $field of Neimheadh\SonataAnnotati...eldTrait::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
            /** @scrutinizer ignore-type */ $filterOptions,
Loading history...
50
            $fieldOptions
0 ignored issues
show
Unused Code introduced by
The call to Neimheadh\SonataAnnotati...eldTrait::__construct() has too many arguments starting with $fieldOptions. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        parent::/** @scrutinizer ignore-call */ 
51
                __construct(

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
51
        );
52
    }
53
54
}
55