diff --git a/composer.json b/composer.json index 06c8a4b..325175d 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "require-dev": { "symfony/form": "^4.0 || ^5.0 || ^6.0", - "doctrine/annotations": "^1.8", + "doctrine/annotations": "^1.8|^2", "doctrine/orm": "^2.7", "phpunit/phpunit": "~7.5 || ~9.5", "symfony/cache-contracts": "^1.0 || ^2.0", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 30800ce..b40e513 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,10 @@ + + + DeprecatedMethod + + int diff --git a/src/Plugin.php b/src/Plugin.php index b82be3a..2afcbee 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -54,8 +54,10 @@ public function __invoke(RegistrationInterface $api, SimpleXMLElement $config = if (class_exists(AnnotationRegistry::class)) { require_once __DIR__.'/Handler/DoctrineRepositoryHandler.php'; - /** @psalm-suppress DeprecatedMethod */ - AnnotationRegistry::registerLoader('class_exists'); + if (method_exists(AnnotationRegistry::class, 'registerLoader')) { + /** @psalm-suppress DeprecatedMethod */ + AnnotationRegistry::registerLoader('class_exists'); + } $api->registerHooksFromClass(DoctrineRepositoryHandler::class); require_once __DIR__.'/Handler/AnnotationHandler.php';