Passed
Push — master ( 641a53...544fde )
by Giancarlos
02:24
created

VoidedDetailValidator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 25
ccs 0
cts 22
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadValidatorMetadata() 0 22 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 18/07/2017
6
 * Time: 01:21 PM
7
 */
8
9
namespace Greenter\Xml\Validator;
10
11
use Symfony\Component\Validator\Mapping\ClassMetadata;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
/**
15
 * Trait VoidedDetailValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait VoidedDetailValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('tipoDoc', [
0 ignored issues
show
Documentation introduced by
array(new \Symfony\Compo...in' => 2, 'max' => 2))) is of type array<integer,object<Sym...Constraints\\Length>"}>, but the function expects a array<integer,object<Sym...\Validator\Constraint>>.

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...
23
            new Assert(),
24
            new Assert\Length([
25
                'min' => 2,
26
                'max' => 2,
27
            ]),
28
        ]);
29
        $metadata->addPropertyConstraints('serie', [
30
            new Assert\NotBlank(),
31
            new Assert\Length([ 'max' => 4]),
32
        ]);
33
        $metadata->addPropertyConstraints('correlativo', [
34
            new Assert\NotBlank(),
35
            new Assert\Length(['max' => 8]),
36
        ]);
37
        $metadata->addPropertyConstraints('desMotivoBaja', [
38
            new Assert\NotBlank(),
39
            new Assert\Length(['max' => 100]),
40
        ]);
41
    }
42
}