Issues (116)

src/Constraint/FieldComparisonTrait.php (1 issue)

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