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

Passed
Push — 0.14 ( 6c4d30 )
by Jérémiah
97:45 queued 93:57
created

AnnotationParser   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 11
Bugs 1 Features 0
Metric Value
eloc 16
c 11
b 1
f 0
dl 0
loc 34
ccs 13
cts 13
cp 1
rs 10
wmc 8

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnnotationReader() 0 15 4
A getMetadatas() 0 11 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Config\Parser;
6
7
use Doctrine\Common\Annotations\AnnotationReader;
8
use Doctrine\Common\Annotations\AnnotationRegistry;
9
use Overblog\GraphQLBundle\Config\Parser\MetadataParser\MetadataParser;
10
use ReflectionClass;
11
use ReflectionMethod;
12
use ReflectionProperty;
13
use Reflector;
14
use RuntimeException;
15
16
class AnnotationParser extends MetadataParser
17
{
18
    const METADATA_FORMAT = '@%s';
19
20
    protected static ?AnnotationReader $annotationReader = null;
21
22 28
    protected static function getMetadatas(Reflector $reflector): array
23
    {
24 28
        $reader = self::getAnnotationReader();
25
26
        switch (true) {
27 28
            case $reflector instanceof ReflectionClass: return $reader->getClassAnnotations($reflector);
28 27
            case $reflector instanceof ReflectionMethod: return $reader->getMethodAnnotations($reflector);
29 27
            case $reflector instanceof ReflectionProperty: return $reader->getPropertyAnnotations($reflector);
30
        }
31
32 27
        return [];
33
    }
34
35 28
    protected static function getAnnotationReader(): AnnotationReader
36
    {
37 28
        if (null === self::$annotationReader) {
38 1
            if (!class_exists(AnnotationReader::class) ||
39 1
                !class_exists(AnnotationRegistry::class)) {
40
                // @codeCoverageIgnoreStart
41
                throw new RuntimeException('In order to use graphql annotation, you need to require doctrine annotations');
42
                // @codeCoverageIgnoreEnd
43
            }
44
45 1
            AnnotationRegistry::registerLoader('class_exists');
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\Common\Annotati...istry::registerLoader() has been deprecated: This method is deprecated and will be removed in doctrine/annotations 2.0. Annotations will be autoloaded in 2.0. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

45
            /** @scrutinizer ignore-deprecated */ AnnotationRegistry::registerLoader('class_exists');

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

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

Loading history...
46 1
            self::$annotationReader = new AnnotationReader();
47
        }
48
49 28
        return self::$annotationReader;
50
    }
51
}
52