Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#353)
by
unknown
12:48
created

AnnotationParser::parseAnnotation()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 18
c 0
b 0
f 0
ccs 0
cts 15
cp 0
rs 9.6666
cc 4
nc 5
nop 1
crap 20
1
<?php
2
3
namespace Overblog\GraphQLBundle\Config\Parser;
4
5
use Overblog\GraphQLBundle\Config\Parser\ParserInterface;
6
use Symfony\Component\Config\Resource\FileResource;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
9
use Zend\Code\Reflection\PropertyReflection;
10
11
class AnnotationParser implements ParserInterface
12
{
13
    public static function getAnnotationReader()
14
    {
15
        if (!class_exists('\\Doctrine\\Common\\Annotations\\AnnotationReader') ||
16
            !class_exists('\\Doctrine\\Common\\Annotations\\AnnotationRegistry')
17
        ) {
18
            throw new \Exception('In order to use annotation, you need to require doctrine ORM');
19
        }
20
21
        $loader = require __DIR__ . '/../../../../autoload.php';
22
23
        \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...istry::registerLoader() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
24
        \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__.'/../../Annotation/GraphQLAnnotation.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
25
        $reader = new \Doctrine\Common\Annotations\AnnotationReader();
26
27
        return $reader;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     *
33
     * @throws \ReflectionException
34
     * @throws InvalidArgumentException
35
     */
36
    public static function parse(\SplFileInfo $file, ContainerBuilder $container)
37
    {
38
        $reader = self::getAnnotationReader();
39
        $container->addResource(new FileResource($file->getRealPath()));
40
        try {
41
            $fileContent = file_get_contents($file->getRealPath());
42
43
            $entityName = substr($file->getFilename(), 0, -4);
44
            if (preg_match('#namespace (.+);#', $fileContent, $namespace)) {
45
                $className = $namespace[1] . '\\' . $entityName;
46
            } else {
47
                $className = $entityName;
48
            }
49
50
            $reflexionEntity = new \ReflectionClass($className);
51
52
            $annotations = $reader->getClassAnnotations($reflexionEntity);
53
            $annotations = self::parseAnnotation($annotations);
54
55
            $alias = self::getGraphQLAlias($annotations) ?: $entityName;
56
            $type = self::getGraphQLType($annotations);
57
58
            switch ($type) {
59
                case 'relay-connection':
60
                    return self::formatRelay($type, $alias, $annotations, $reflexionEntity->getProperties());
0 ignored issues
show
Documentation introduced by
$reflexionEntity->getProperties() is of type array<integer,object<ReflectionProperty>>, but the function expects a array<integer,object<Zen...on\PropertyReflection>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
61
                case 'enum':
62
                    return self::formatEnumType($alias, $entityName, $reflexionEntity->getProperties());
63
                case 'custom-scalar':
64
                    return self::formatCustomScalarType($alias, $type, $className);
65
                default:
66
                    return self::formatScalarType($alias, $type, $entityName, $reflexionEntity->getProperties());
67
            }
68
        } catch (\InvalidArgumentException $e) {
69
            throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
70
        }
71
    }
72
73
    /**
74
     * Get the graphQL alias
75
     *
76
     * @param $annotation
77
     *
78
     * @return string|null
79
     */
80 View Code Duplication
    protected static function getGraphQLAlias($annotation)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
81
    {
82
        if (array_key_exists('GraphQLAlias', $annotation) && !empty($annotation['GraphQLAlias']['name'])) {
83
            return $annotation['GraphQLAlias']['name'];
84
        }
85
86
        return null;
87
    }
88
89
    /**
90
     * Get the graphQL type
91
     *
92
     * @param $annotation
93
     *
94
     * @return string
95
     */
96 View Code Duplication
    protected static function getGraphQLType($annotation)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
97
    {
98
        if (array_key_exists('GraphQLType', $annotation) && !empty($annotation['GraphQLType']['type'])) {
99
            return $annotation['GraphQLType']['type'];
100
        }
101
102
        return 'object';
103
    }
104
105
    /**
106
     * @param string               $type
107
     * @param string               $alias
108
     * @param array                $classAnnotations
109
     * @param PropertyReflection[] $properties
110
     *
111
     * @return array
112
     *
113
     * @throws \Exception
114
     */
115
    protected static function formatRelay($type, $alias, $classAnnotations, $properties)
116
    {
117
        $reader = self::getAnnotationReader();
118
119
        $typesConfig = [
120
            $alias => [
121
                'type' => $type,
122
                'config' => [],
123
            ]
124
        ];
125
126
        if (!empty($classAnnotations['GraphQLNode'])) {
127
            $typesConfig[$alias]['config']['nodeType'] = $classAnnotations['GraphQLNode']['type'];
128
            $typesConfig[$alias]['config']['resolveNode'] = $classAnnotations['GraphQLNode']['resolve'];
129
        }
130
131
        foreach ($properties as $property) {
132
            $propertyName = $property->getName();
133
            $propertyAnnotation = $reader->getPropertyAnnotations($property);
134
            $propertyAnnotation = self::parseAnnotation($propertyAnnotation);
135
136
            if (!empty($propertyAnnotation['GraphQLEdgeFields'])) {
137 View Code Duplication
                if (empty($typesConfig[$alias]['config']['edgeFields'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
138
                    $typesConfig[$alias]['config']['edgeFields'] = [];
139
                }
140
141
                $typesConfig[$alias]['config']['edgeFields'][$propertyName] = [
142
                    'type' => $propertyAnnotation['GraphQLEdgeFields']['type'],
143
                    'resolve' => $propertyAnnotation['GraphQLEdgeFields']['resolve'],
144
                ];
145
            } elseif (!empty($propertyAnnotation['GraphQLConnectionFields'])) {
146 View Code Duplication
                if (empty($typesConfig[$alias]['config']['connectionFields'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
147
                    $typesConfig[$alias]['config']['connectionFields'] = [];
148
                }
149
150
                $typesConfig[$alias]['config']['connectionFields'][$propertyName] = [
151
                    'type' => $propertyAnnotation['GraphQLConnectionFields']['type'],
152
                    'resolve' => $propertyAnnotation['GraphQLConnectionFields']['resolve'],
153
                ];
154
            }
155
        }
156
157
        return empty($typesConfig[$alias]['config'])
158
            ? []
159
            : $typesConfig;
160
    }
161
162
    /**
163
     * Format enum type
164
     *
165
     * @param string                     $alias
166
     * @param string                     $entityName
167
     * @param \ReflectionProperty[]      $properties
168
     *
169
     * @return array
170
     */
171
    protected static function formatEnumType($alias, $entityName, $properties)
172
    {
173
        $reader = self::getAnnotationReader();
174
175
        $typesConfig = [
176
            $alias => [
177
                'type' => 'enum',
178
                'config' => [
179
                    'description' => $entityName . ' type',
180
                ],
181
            ]
182
        ];
183
184
        $values = [];
185
        /** @var \ReflectionProperty $property */
186
        foreach ($properties as $property) {
187
            $propertyName = $property->getName();
188
189
            $propertyAnnotation = $reader->getPropertyAnnotations($property);
190
            $propertyAnnotation = self::parseAnnotation($propertyAnnotation);
191
192
            $values[$propertyName] = [
193
                'value' => $propertyAnnotation,
194
            ];
195
196
            if (array_key_exists('GraphQLDescription', $propertyAnnotation) && !empty($test['GraphQLDescription']['description'])) {
197
                $values[$propertyName]['description'] = $test['GraphQLDescription']['description'];
198
            }
199
        }
200
201
        $typesConfig[$alias]['config']['values'] = $values;
202
203
        return $typesConfig;
204
    }
205
206
    /**
207
     * Format custom scalar type
208
     *
209
     * @param string $alias
210
     * @param string $type
211
     * @param string $className
212
     *
213
     * @return array
214
     */
215
    protected static function formatCustomScalarType($alias, $type, $className)
216
    {
217
        $config = [
218
            'serialize' => [$className, 'serialize'],
219
            'parseValue' => [$className, 'parseValue'],
220
            'parseLiteral' => [$className, 'parseLiteral'],
221
        ];
222
223
        return [
224
            $alias => [
225
                'type' => $type,
226
                'config' => $config,
227
            ]
228
        ];
229
    }
230
231
    /**
232
     * Format scalar type
233
     *
234
     * @param string                $alias
235
     * @param string                $type
236
     * @param string                $entityName
237
     * @param \ReflectionProperty[] $properties
238
     *
239
     * @return array
240
     */
241
    protected static function formatScalarType($alias, $type, $entityName, $properties)
242
    {
243
        $reader = self::getAnnotationReader();
244
245
        $typesConfig = [
246
            $alias => [
247
                'type' => $type,
248
                'config' => [
249
                    'description' => $entityName . ' type',
250
                    'fields' => [],
251
                ],
252
            ]
253
        ];
254
255
        foreach ($properties as $property) {
256
            $propertyName = $property->getName();
257
            $propertyAnnotation = $reader->getPropertyAnnotations($property);
258
            $propertyAnnotation = self::parseAnnotation($propertyAnnotation);
259
260
            if (!$graphQlType = self::getGraphQLFieldType($propertyName, $propertyAnnotation)) {
261
                continue;
262
            }
263
264
            if ($graphQlAccessControl = self::getGraphQLAccessControl($propertyAnnotation)) {
265
                $graphQlType['access'] = $graphQlAccessControl;
266
            }
267
268
            if ($graphQlPublicControl = self::getGraphQLPublicControl($propertyAnnotation)) {
269
                $graphQlType['public'] = $graphQlPublicControl;
270
            }
271
272
            $typesConfig[$alias]['config']['fields'][$propertyName] = $graphQlType;
273
        }
274
275
        return empty($typesConfig[$alias]['config']['fields'])
276
            ? []
277
            : $typesConfig;
278
    }
279
280
    /**
281
     * Return the graphQL type for the named field
282
     *
283
     * @param string $name
284
     * @param array  $annotation
285
     *
286
     * @return array|null
287
     */
288
    protected static function getGraphQLFieldType($name, $annotation)
289
    {
290
        if (!$type = self::getGraphQLScalarFieldType($name, $annotation)) {
291
            if (!$type = self::getGraphQLQueryField($annotation)) {
292
                if (!$type = self::getGraphQLMutationField($annotation)) {
293
                    return null;
294
                }
295
            }
296
        }
297
298
        return $type;
299
    }
300
301
    /**
302
     * Return the common field type, like ID, Int, String, and other user-created type
303
     *
304
     * @param string $name
305
     * @param array  $annotation
306
     *
307
     * @return array|null
308
     */
309
    protected static function getGraphQLScalarFieldType($name, $annotation)
310
    {
311
        // Get the current type, depending on current annotation
312
        $type = $graphQLType = null;
0 ignored issues
show
Unused Code introduced by
$graphQLType is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
313
        $nullable = $isMultiple = false;
314
        if (array_key_exists('GraphQLColumn', $annotation) && array_key_exists('type', $annotation['GraphQLColumn'])) {
315
            $annotation = $annotation['GraphQLColumn'];
316
            $type = $annotation['type'];
317 View Code Duplication
        } elseif (array_key_exists('GraphQLToMany', $annotation) && array_key_exists('target', $annotation['GraphQLToMany'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
318
            $annotation = $annotation['GraphQLToMany'];
319
            $type = $annotation['target'];
320
            $isMultiple = $nullable = true;
321
        } elseif (array_key_exists('GraphQLToOne', $annotation) && array_key_exists('target', $annotation['GraphQLToOne'])) {
322
            $annotation = $annotation['GraphQLToOne'];
323
            $type = $annotation['target'];
324
            $nullable = true;
325 View Code Duplication
        } elseif (array_key_exists('OneToMany', $annotation) && array_key_exists('targetEntity', $annotation['OneToMany'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
326
            $annotation = $annotation['OneToMany'];
327
            $type = $annotation['targetEntity'];
328
            $isMultiple = $nullable = true;
329
        } elseif (array_key_exists('OneToOne', $annotation) && array_key_exists('targetEntity', $annotation['OneToOne'])) {
330
            $annotation = $annotation['OneToOne'];
331
            $type = $annotation['targetEntity'];
332
            $nullable = true;
333 View Code Duplication
        } elseif (array_key_exists('ManyToMany', $annotation) && array_key_exists('targetEntity', $annotation['ManyToMany'])) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
334
            $annotation = $annotation['ManyToMany'];
335
            $type = $annotation['targetEntity'];
336
            $isMultiple = $nullable = true;
337
        } elseif (array_key_exists('ManyToOne', $annotation) && array_key_exists('targetEntity', $annotation['ManyToOne'])) {
338
            $annotation = $annotation['ManyToOne'];
339
            $type = $annotation['targetEntity'];
340
            $nullable = true;
341
        } elseif (array_key_exists('Column', $annotation) && array_key_exists('type', $annotation['Column'])) {
342
            $annotation = $annotation['Column'];
343
            $type = $annotation['type'];
344
        }
345
346
        if (!$type) {
347
            return null;
348
        }
349
350
        if (array_key_exists('nullable', $annotation)) {
351
            $nullable = $annotation['nullable'] == 'true'
352
                ? true
353
                : false;
354
        }
355
356
        $type = explode('\\', $type);
357
        $type = $type[count($type)-1];
358
359
        // Get the graphQL type representation
360
        // Specific case for ID and relation
361
        if ($name === 'id' && $type === 'integer') {
362
            $graphQLType = 'ID';
363
        } else {
364
            // Make the relation between doctrine Column type and graphQL type
365
            switch ($type) {
366
                case 'integer';
0 ignored issues
show
Coding Style introduced by
case statements should be defined using a colon.

As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next break.

There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.

switch ($expr) {
    case "A": { //wrong
        doSomething();
        break;
    }
    case "B"; //wrong
        doSomething();
        break;
    case "C": //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
367
                    $graphQLType = 'Int';
368
                    break;
369
                case 'string':
370
                case 'text':
371
                    $graphQLType = 'String';
372
                    break;
373
                case 'bool':
374
                case 'boolean':
375
                    $graphQLType = 'Boolean';
376
                    break;
377
                case 'float':
378
                    $graphQLType = 'Float';
379
                    break;
380
                default:
381
                    // No maching: considering is custom-scalar graphQL type
382
                    $graphQLType = $type;
383
            }
384
        }
385
386
        if ($isMultiple) {
387
            $graphQLType = '['.$graphQLType.']';
388
        }
389
390
        if (!$nullable) {
391
            $graphQLType .= '!';
392
        }
393
394
        return ['type' => $graphQLType];
395
    }
396
397
    /**
398
     * Get the graphql query formatted field
399
     *
400
     * @param array $annotation
401
     *
402
     * @return array|null
403
     */
404
    protected static function getGraphQLQueryField($annotation)
405
    {
406
        if (!array_key_exists('GraphQLQuery', $annotation)) {
407
            return null;
408
        }
409
410
        $annotationQuery = $annotation['GraphQLQuery'];
411
412
        $ret = [
413
            'type' => $annotationQuery['type'],
414
        ];
415
416
        $method = $annotationQuery['method'];
417
        $args = $queryArgs = [];
418
        if (!empty($annotationQuery['input'])) {
419
            $annotationArgs = $annotationQuery['input'];
420
            if (!array_key_exists(0, $annotationArgs)) {
421
                $annotationArgs = [$annotationArgs];
422
            }
423
424
            foreach ($annotationArgs as $arg) {
425
                if (!empty($arg['name'])) {
426
                    $args[$arg['name']] = [
427
                        'type' => $arg['type'],
428
                    ];
429
430
                    if (!empty($arg['description'])) {
431
                        $args[$arg['name']]['description'] = $arg['description'];
432
                    }
433
                }
434
435
                $queryArgs[] = $arg['target'];
436
            }
437
438
            if (!empty($args)) {
439
                $ret['args'] = $args;
440
            }
441
        }
442
443
        if (!empty($queryArgs)) {
444
            $query = "'".$method."', [".implode(', ', $queryArgs)."]";
445
        } else {
446
            $query = "'".$method."'";
447
        }
448
449
        $ret['resolve'] = "@=resolver(".$query.")";
450
451
        if (!empty($annotationQuery['argsBuilder'])) {
452
            $ret['argsBuilder'] = $annotationQuery['argsBuilder'];
453
454
        }
455
456
        return $ret;
457
    }
458
459
    /**
460
     * Get the formatted graphQL mutation field
461
     *
462
     * @param array $annotation
463
     *
464
     * @return array
465
     */
466
    protected static function getGraphQLMutationField($annotation)
467
    {
468
        if (!array_key_exists('GraphQLMutation', $annotation)) {
469
            return self::getGraphQLRelayMutationField($annotation);
470
        }
471
472
        // @TODO
473
    }
474
475
    /**
476
     * Get the formatted graphQL relay mutation field
477
     *
478
     * @param array $annotation
479
     *
480
     * @return array|null
481
     */
482
    protected static function getGraphQLRelayMutationField($annotation)
483
    {
484
        if (!array_key_exists('GraphQLRelayMutation', $annotation)) {
485
            return null;
486
        }
487
488
        $annotation = $annotation['GraphQLRelayMutation'];
489
        if (array_key_exists('args', $annotation)) {
490
            $mutate = "'".$annotation['method']."', [".implode(', ', $annotation['args'])."]";
491
        } else {
492
            $mutate = "'".$annotation['method']."'";
493
        }
494
495
        return [
496
            "builder" => "Relay::Mutation",
497
            "builderConfig" => [
498
                "inputType" => $annotation['input'],
499
                "payloadType" => $annotation['payload'],
500
                "mutateAndGetPayload" => "@=mutation(".$mutate.")",
501
            ],
502
        ];
503
    }
504
505
    /**
506
     * Get graphql access control annotation
507
     *
508
     * @param $annotation
509
     *
510
     * @return null|string
511
     */
512 View Code Duplication
    protected static function getGraphQLAccessControl($annotation)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
513
    {
514
        if (array_key_exists('GraphQLAccessControl', $annotation) && array_key_exists('method', $annotation['GraphQLAccessControl'])) {
515
            return '@='.$annotation['GraphQLAccessControl']['method'];
516
        }
517
518
        return null;
519
    }
520
521
    /**
522
     * Get graphql public control
523
     *
524
     * @param $annotation
525
     *
526
     * @return null|string
527
     */
528 View Code Duplication
    protected static function getGraphQLPublicControl($annotation)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
529
    {
530
        if (array_key_exists('GraphQLPublicControl', $annotation) && array_key_exists('method', $annotation['GraphQLPublicControl'])) {
531
            return '@='.$annotation['GraphQLPublicControl']['method'];
532
        }
533
534
        return null;
535
    }
536
537
    /**
538
     * Parse annotation
539
     *
540
     * @param mixed $annotation
0 ignored issues
show
Documentation introduced by
There is no parameter named $annotation. Did you maybe mean $annotations?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
541
     *
542
     * @return array
543
     */
544
    protected static function parseAnnotation($annotations)
545
    {
546
        $returnAnnotation = [];
547
        foreach ($annotations as $index => $annotation) {
548
            if (!is_array($annotation)) {
549
                $index = explode('\\', get_class($annotation));
550
                $index = $index[count($index) - 1];
551
            }
552
553
            $returnAnnotation[$index] = [];
554
555
            foreach ($annotation as $indexAnnotation => $value) {
556
                $returnAnnotation[$index][$indexAnnotation] = $value;
557
            }
558
        }
559
560
        return $returnAnnotation;
561
    }
562
}
563