Completed
Push — implicit-property ( 7848fa )
by Michael
11:42
created

InternalAnnotations   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 56
dl 0
loc 73
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B createMetadata() 0 71 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\Implicit;
11
use Doctrine\Annotations\Annotation\Target;
12
13
/**
14
 * Internal meta-annotations exposed by the Annotations library to declare custom user-land annotations.
15
 *
16
 * @internal
17
 */
18
final class InternalAnnotations
19
{
20
    public static function createMetadata() : MetadataCollection
21
    {
22
        return new TransientMetadataCollection(
23
            new AnnotationMetadata(
24
                Attribute::class,
25
                AnnotationTarget::annotation(),
26
                false,
27
                new PropertyMetadata(
28
                    'name',
29
                    ['type' => 'string'],
30
                    true,
31
                    true
32
                ),
33
                new PropertyMetadata(
34
                    'type',
35
                    ['type' => 'string'],
36
                    true
37
                ),
38
                new PropertyMetadata(
39
                    'required',
40
                    ['type' => 'boolean']
41
                )
42
            ),
43
            new AnnotationMetadata(
44
                Attributes::class,
45
                AnnotationTarget::class(),
46
                false,
47
                new PropertyMetadata(
48
                    'value',
49
                    [
50
                        'type'       => 'array',
51
                        'array_type' =>Attribute::class,
52
                        'value'      =>'array<' . Attribute::class . '>',
53
                    ],
54
                    true,
55
                    true
56
                )
57
            ),
58
            new AnnotationMetadata(
59
                Enum::class,
60
                AnnotationTarget::property(),
61
                true,
62
                new PropertyMetadata(
63
                    'value',
64
                    ['type' => 'array'],
65
                    true,
66
                    true
67
                ),
68
                new PropertyMetadata(
69
                    'literal',
70
                    ['type' => 'array']
71
                )
72
            ),
73
            new AnnotationMetadata(
74
                Implicit::class,
75
                AnnotationTarget::property(),
76
                false
77
            ),
78
            new AnnotationMetadata(
79
                Target::class,
80
                AnnotationTarget::class(),
81
                true,
82
                new PropertyMetadata(
83
                    'value',
84
                    [
85
                        'type'      =>'array',
86
                        'array_type'=>'string',
87
                        'value'     =>'array<string>',
88
                    ],
89
                    false,
90
                    true
91
                )
92
            )
93
        );
94
    }
95
}
96