diff --git a/DependencyInjection/GraphQLiteCompilerPass.php b/DependencyInjection/GraphQLiteCompilerPass.php index e75c88c..16e85ad 100644 --- a/DependencyInjection/GraphQLiteCompilerPass.php +++ b/DependencyInjection/GraphQLiteCompilerPass.php @@ -428,9 +428,12 @@ private static function getParametersByName(ReflectionMethod $method): array */ private function getAnnotationReader(): AnnotationReader { - if ($this->annotationReader === null) { - AnnotationRegistry::registerLoader('class_exists'); - + if ($this->annotationReader === null) { + if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) { + AnnotationRegistry::registerUniqueLoader('class_exists'); + } elseif (method_exists(AnnotationRegistry::class, 'registerLoader')) { + AnnotationRegistry::registerLoader('class_exists'); + } $doctrineAnnotationReader = new DoctrineAnnotationReader(); if (ApcuAdapter::isSupported()) {