FieldComparisonTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 24
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultOption() 0 3 1
A __construct() 0 3 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