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   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnnotationReader() 0 13 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
    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