Issues (13)

src/Compiler/Doctrine/Bootstrap.php (2 issues)

1
<?php
2
3
declare(strict_types = 1);
4
5
namespace inroutephp\inroute\Compiler\Doctrine;
6
7
use inroutephp\inroute\Compiler\BootstrapInterface;
8
use inroutephp\inroute\Compiler\Settings\SettingsInterface;
9
use inroutephp\inroute\Compiler\Exception\CompilerException;
10
use Doctrine\Common\Annotations\AnnotationRegistry;
11
12
/**
13
 * Register a global doctrine annotaion loader using class_exists
14
 */
15
final class Bootstrap implements BootstrapInterface
16
{
17
    public function bootstrap(SettingsInterface $settings): void
18
    {
19
        if (!class_exists(AnnotationRegistry::CLASS)) {
0 ignored issues
show
The constant Doctrine\Common\Annotati...notationRegistry::CLASS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
20
            throw new CompilerException('Doctrine annotations not loaded. Require doctrine/annotations^1.6');
21
        }
22
23
        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 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists') ( Ignorable by Annotation )

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

23
        /** @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...
24
    }
25
}
26