Passed
Pull Request — master (#1361)
by
unknown
03:18
created

VersionConstraints::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Annotation;
6
7
use Composer\Semver\Semver as ComposerSemver;
8
9
/**
10
 * @Annotation
11
 * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
12
 */
13
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
14
final class VersionConstraints extends Version
15
{
16
    public function __construct($values = [], ?string $version = null)
17
    {
18
        if (!class_exists(ComposerSemver::class)) {
19
            throw new \LogicException(sprintf('composer/semver must be installed to use "%s".', self::class));
20
        }
21
22
        parent::__construct($values, $version);
23
    }
24
}
25