Test Failed
Pull Request — master (#97)
by Aleksei
08:10
created

AnnotatedSchemaConveyor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 21
ccs 3
cts 3
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getGenerators() 0 13 2
A getMetadataReader() 0 3 1
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 CompositedSchemaConveyor
11
{
12
    private bool $isAutoloadRegistered = false;
13
14
    public function getGenerators(): array
15
    {
16
        if (!$this->isAutoloadRegistered) {
17
            /**
18
             * autoload annotations
19
             *
20
             * @psalm-suppress DeprecatedMethod
21
             */
22
            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
            $this->isAutoloadRegistered = true;
24
        }
25
26 3
        return parent::getGenerators();
27
    }
28 3
    protected function getMetadataReader(): AnnotationReader
29 3
    {
30
        return new AnnotationReader();
31 4
    }
32
}
33