Skip to content

Commit

Permalink
Merge pull request #129 from jaytaph/annotation-loader-fix
Browse files Browse the repository at this point in the history
Call annotation loader only if it exists
  • Loading branch information
jaytaph authored Mar 13, 2023
2 parents 61e6e67 + 84c9f3d commit f5fe8e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Doctrine\Common\Annotations\AnnotationRegistry;

function includeIfExists($file)
{
if (file_exists($file)) {
Expand All @@ -16,8 +18,8 @@ function includeIfExists($file)
'php composer.phar install'.PHP_EOL);
}

if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
AnnotationRegistry::registerLoader('class_exists');
}

// force loading the XRateLimit annotation since the composer target-dir autoloader does not run through $loader::loadClass
Expand Down

0 comments on commit f5fe8e0

Please sign in to comment.