Failed Conditions
Pull Request — master (#247)
by Michael
13:16
created

InternalAnnotations   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 56
dl 0
loc 79
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
/**
15
 * @internal
16
 */
17
final class InternalAnnotations
18
{
19
    /**
20
     * @return string[]
21
     */
22
    public static function getNames() : iterable
23
    {
24
        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...
25
        yield IgnoreAnnotation::class;
26
        yield Required::class;
27
        yield Target::class;
28
    }
29
30
    public static function createMetadata() : MetadataCollection
31
    {
32
        return new MetadataCollection(
33
            new AnnotationMetadata(
34
                Attribute::class,
35
                AnnotationTarget::annotation(),
36
                false,
37
                new PropertyMetadata(
38
                    'name',
39
                    ['type' => 'string'],
40
                    true,
41
                    true
42
                ),
43
                new PropertyMetadata(
44
                    'type',
45
                    ['type' => 'string'],
46
                    true
47
                ),
48
                new PropertyMetadata(
49
                    'required',
50
                    ['type' => 'boolean']
51
                )
52
            ),
53
            new AnnotationMetadata(
54
                Attributes::class,
55
                AnnotationTarget::class(),
56
                false,
57
                new PropertyMetadata(
58
                    'value',
59
                    [
60
                        'type'       => 'array',
61
                        'array_type' =>'Doctrine\Annotations\Annotation\Attribute',
62
                        'value'      =>'array<Doctrine\Annotations\Annotation\Attribute>',
63
                    ],
64
                    true,
65
                    true
66
                )
67
            ),
68
            new AnnotationMetadata(
69
                Enum::class,
70
                AnnotationTarget::property(),
71
                true,
72
                new PropertyMetadata(
73
                    'value',
74
                    ['type' => 'array'],
75
                    true,
76
                    true
77
                ),
78
                new PropertyMetadata(
79
                    'literal',
80
                    ['type' => 'array']
81
                )
82
            ),
83
            new AnnotationMetadata(
84
                Target::class,
85
                AnnotationTarget::class(),
86
                true,
87
                new PropertyMetadata(
88
                    'value',
89
                    [
90
                        'type'      =>'array',
91
                        'array_type'=>'string',
92
                        'value'     =>'array<string>',
93
                    ],
94
                    false,
95
                    true
96
                )
97
            )
98
        );
99
    }
100
}
101