Failed Conditions
Push — type ( c389f1...fc7bda )
by Michael
02:26
created

InternalAnnotations::createMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 58
Code Lines 47

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 48
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 47
dl 0
loc 58
ccs 48
cts 48
cp 1
rs 9.1563
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
use Doctrine\Annotations\Type\ArrayType;
12
use Doctrine\Annotations\Type\BooleanType;
13
use Doctrine\Annotations\Type\ListType;
0 ignored issues
show
Bug introduced by
The type Doctrine\Annotations\Type\ListType was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Doctrine\Annotations\Type\MixedType;
15
use Doctrine\Annotations\Type\ObjectType;
16
use Doctrine\Annotations\Type\StringType;
17
18
/**
19
 * @internal
20
 */
21
final class InternalAnnotations
22
{
23 290
    public static function createMetadata() : MetadataCollection
24
    {
25 290
        return new TransientMetadataCollection(
26 290
            new AnnotationMetadata(
27 290
                Attribute::class,
28 290
                AnnotationTarget::annotation(),
29 290
                false,
30 290
                new PropertyMetadata(
31 290
                    'name',
32 290
                    new StringType(),
33 290
                    true,
34 290
                    true
35
                ),
36 290
                new PropertyMetadata(
37 290
                    'type',
38 290
                    new StringType(),
39 290
                    true
40
                ),
41 290
                new PropertyMetadata(
42 290
                    'required',
43 290
                    new BooleanType()
44
                )
45
            ),
46 290
            new AnnotationMetadata(
47 290
                Attributes::class,
48 290
                AnnotationTarget::class(),
49 290
                false,
50 290
                new PropertyMetadata(
51 290
                    'value',
52 290
                    new ArrayType(new MixedType(), new ObjectType(Attribute::class)),
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
                    new ArrayType(new MixedType(), new MixedType()),
64 290
                    true,
65 290
                    true
66
                ),
67 290
                new PropertyMetadata(
68 290
                    'literal',
69 290
                    new ArrayType(new MixedType(), new MixedType())
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 290
                    new ArrayType(new MixedType(), new StringType()),
79 290
                    false,
80 290
                    true
81
                )
82
            )
83
        );
84
    }
85
}
86