Passed
Pull Request — master (#247)
by Michael
02:00
created

InternalAnnotations   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 52
dl 0
loc 68
ccs 48
cts 48
cp 1
rs 10
c 0
b 0
f 0

1 Method

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