Failed Conditions
Pull Request — new-parser-ast-metadata (#3)
by
unknown
02:14
created

RequiredConstraint::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Assembler\Validator\Constraint;
6
7
use Doctrine\Annotations\Assembler\Validator\Constraint\Exception\MissingRequiredValue;
8
9
final class RequiredConstraint implements Constraint
10
{
11
    /**
12
     * @param mixed $value
13
     */
14 3
    public function validate($value) : void
15
    {
16 3
        if ($value === null) {
17 2
            throw MissingRequiredValue::new();
18
        }
19 2
    }
20
}
21