Failed Conditions
Push — annotation-metadata ( 414255 )
by Michael
02:42
created

InternalAnnotations   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 2
eloc 56
dl 0
loc 79
ccs 48
cts 54
cp 0.8889
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createMetadata() 0 66 1
A getNames() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Metadata;
6
7
use Doctrine\Annotations\Annotation\Attribute;
8
use Doctrine\Annotations\Annotation\Attributes;
9
use Doctrine\Annotations\Annotation\Enum;
10
use Doctrine\Annotations\Annotation\IgnoreAnnotation;
11
use Doctrine\Annotations\Annotation\Required;
12
use Doctrine\Annotations\Annotation\Target;
13
14
final class InternalAnnotations
15
{
16
    /**
17
     * @return string[]
18
     */
19
    public static function getNames() : iterable
20
    {
21
        yield Enum::class;
0 ignored issues
show
Bug Best Practice introduced by
The expression yield Doctrine\Annotations\Annotation\Enum::class returns the type Generator which is incompatible with the documented return type string[].
Loading history...
22
        yield IgnoreAnnotation::class;
23
        yield Required::class;
24
        yield Target::class;
25
    }
26
27 278
    public static function createMetadata() : MetadataCollection
28
    {
29 278
        return new MetadataCollection(
30 278
            new AnnotationMetadata(
31 278
                Attribute::class,
32 278
                AnnotationTarget::annotation(),
33 278
                false,
34 278
                new PropertyMetadata(
35 278
                    'name',
36 278
                    ['type' => 'string'],
37 278
                    true,
38 278
                    true
39
                ),
40 278
                new PropertyMetadata(
41 278
                    'type',
42 278
                    ['type' => 'string'],
43 278
                    true
44
                ),
45 278
                new PropertyMetadata(
46 278
                    'required',
47 278
                    ['type' => 'boolean']
48
                )
49
            ),
50 278
            new AnnotationMetadata(
51 278
                Attributes::class,
52 278
                AnnotationTarget::class(),
53 278
                false,
54 278
                new PropertyMetadata(
55 278
                    'value',
56
                    [
57 278
                        'type'       => 'array',
58
                        'array_type' =>'Doctrine\Annotations\Annotation\Attribute',
59
                        'value'      =>'array<Doctrine\Annotations\Annotation\Attribute>',
60
                    ],
61 278
                    true,
62 278
                    true
63
                )
64
            ),
65 278
            new AnnotationMetadata(
66 278
                Enum::class,
67 278
                AnnotationTarget::property(),
68 278
                true,
69 278
                new PropertyMetadata(
70 278
                    'value',
71 278
                    ['type' => 'array'],
72 278
                    true,
73 278
                    true
74
                ),
75 278
                new PropertyMetadata(
76 278
                    'literal',
77 278
                    ['type' => 'array']
78
                )
79
            ),
80 278
            new AnnotationMetadata(
81 278
                Target::class,
82 278
                AnnotationTarget::class(),
83 278
                true,
84 278
                new PropertyMetadata(
85 278
                    'value',
86
                    [
87 278
                        'type'      =>'array',
88
                        'array_type'=>'string',
89
                        'value'     =>'array<string>',
90
                    ],
91 278
                    false,
92 278
                    true
93
                )
94
            )
95
        );
96
    }
97
}
98