Skip to content

Commit

Permalink
Support both annotation 1/2 versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aszenz authored Aug 29, 2023
1 parent 52582f4 commit 5c1f899
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions DependencyInjection/GraphQLiteCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 5c1f899

Please sign in to comment.