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
Pull Request — master (#801)
by Timur
20:26
created

AnnotationParser::unionAnnotationToGQLConfiguration()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 38
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 8

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
c 1
b 0
f 0
dl 0
loc 38
ccs 23
cts 23
cp 1
rs 8.4444
cc 8
nc 8
nop 2
crap 8
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
    protected static function getMetadatas(Reflector $reflector): array
23
    {
24
        $reader = self::getAnnotationReader();
25
26
        switch (true) {
27
            case $reflector instanceof ReflectionClass: return $reader->getClassAnnotations($reflector);
28
            case $reflector instanceof ReflectionMethod: return $reader->getMethodAnnotations($reflector);
29
            case $reflector instanceof ReflectionProperty: return $reader->getPropertyAnnotations($reflector);
30
        }
31
32
        return [];
33
    }
34
35
    protected static function getAnnotationReader(): AnnotationReader
36
    {
37
        if (null === self::$annotationReader) {
38
            if (!class_exists(AnnotationReader::class) ||
39
                !class_exists(AnnotationRegistry::class)) {
40
                throw new RuntimeException('In order to use graphql annotation, you need to require doctrine annotations');
41
            }
42
43
            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

43
            /** @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...
44
            self::$annotationReader = new AnnotationReader();
45
        }
46
47
        return self::$annotationReader;
48
    }
49
}
50