FieldComparisonTrait::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Bdf\Form\Constraint;
4
5
use Bdf\Form\Util\FieldPath;
6
use Symfony\Component\Validator\Constraint;
7
8
/**
9
 * Add field option on comparison class
10
 * The class must extends a subclass of AbstractComparison
11
 */
12
trait FieldComparisonTrait
13
{
14
    /**
15
     * The field path
16
     *
17
     * @var string|FieldPath
18
     */
19
    public $field;
20
21
    /**
22
     * FieldComparisonTrait constructor.
23
     * @param string|FieldPath|array $field
24
     */
25 8
    public function __construct($field)
26
    {
27 8
        Constraint::__construct($field);
0 ignored issues
show
Bug Best Practice introduced by
The method Symfony\Component\Valida...nstraint::__construct() is not static, but was called statically. ( Ignorable by Annotation )

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

27
        Constraint::/** @scrutinizer ignore-call */ 
28
                    __construct($field);
Loading history...
28 8
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 8
    public function getDefaultOption(): ?string
34
    {
35 8
        return 'field';
36
    }
37
}
38