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

InvalidTarget::method()   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\Metadata;
6
7
use LogicException;
8
use function sprintf;
9
10
final class InvalidTarget extends LogicException implements ValidationException
11
{
12
    public static function class(AnnotationMetadata $metadata) : self
13
    {
14
        return new self(
15
            sprintf(
16
                'Class target is not allowed for annotation %s',
17
                $metadata->getName()
18
            )
19
        );
20
    }
21 1
    public static function property(AnnotationMetadata $metadata) : self
22
    {
23 1
        return new self(
24 1
            sprintf(
25 1
                'Property target is not allowed for annotation %s',
26 1
                $metadata->getName()
27
            )
28
        );
29
    }
30 1
    public static function method(AnnotationMetadata $metadata) : self
31
    {
32 1
        return new self(
33 1
            sprintf(
34 1
                'Method target is not allowed for annotation %s',
35 1
                $metadata->getName()
36
            )
37
        );
38
    }
39
40 3
    public static function annotation(AnnotationMetadata $metadata) : self
41
    {
42 3
        return new self(
43 3
            sprintf(
44 3
                'Annotation target is not allowed for annotation %s',
45 3
                $metadata->getName()
46
            )
47
        );
48
    }
49
}
50