Passed
Pull Request — master (#97)
by Aleksei
04:51 queued 02:29
created

AnnotatedSchemaConveyor::addAnnotatedGenerators()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 9.9666
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Schema\Conveyor;
6
7
use Doctrine\Common\Annotations\AnnotationRegistry;
8
use Spiral\Attributes\AnnotationReader;
9
10
final class AnnotatedSchemaConveyor extends MetadataSchemaConveyor
11
{
12
    private bool $isAutoloadRegistered = false;
13
14 9
    public function getGenerators(): array
15
    {
16 9
        if (!$this->isAutoloadRegistered) {
17
            /**
18
             * autoload annotations
19
             *
20
             * @psalm-suppress DeprecatedMethod
21
             */
22 9
            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

22
            /** @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...
23 9
            $this->isAutoloadRegistered = true;
24
        }
25
26 9
        return parent::getGenerators();
27
    }
28
29 8
    protected function getMetadataReader(): AnnotationReader
30
    {
31 8
        return new AnnotationReader();
32
    }
33
}
34