Passed
Pull Request — new-parser-ast-metadata (#2)
by
unknown
02:09
created

InvalidTarget::property()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Assembler\Validator\Exception;
6
7
use Doctrine\Annotations\Metadata\AnnotationMetadata;
8
use LogicException;
9
use function sprintf;
10
11
final class InvalidTarget extends LogicException implements ValidationException
12
{
13
    public static function class(AnnotationMetadata $metadata) : self
14
    {
15
        return new self(
16
            sprintf(
17
                'Class target is not allowed for annotation %s',
18
                $metadata->getName()
19
            )
20
        );
21
    }
22 1
    public static function property(AnnotationMetadata $metadata) : self
23
    {
24 1
        return new self(
25 1
            sprintf(
26 1
                'Property target is not allowed for annotation %s',
27 1
                $metadata->getName()
28
            )
29
        );
30
    }
31 1
    public static function method(AnnotationMetadata $metadata) : self
32
    {
33 1
        return new self(
34 1
            sprintf(
35 1
                'Method target is not allowed for annotation %s',
36 1
                $metadata->getName()
37
            )
38
        );
39
    }
40
41 3
    public static function annotation(AnnotationMetadata $metadata) : self
42
    {
43 3
        return new self(
44 3
            sprintf(
45 3
                'Annotation target is not allowed for annotation %s',
46 3
                $metadata->getName()
47
            )
48
        );
49
    }
50
}
51