Skip to content

Commit 1a38306

Browse files
Call AnnotationRegistry registerLoader only when available
1 parent 5953011 commit 1a38306

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

bootstrap/bootstrap.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@
2323

2424
use Doctrine\Common\Annotations\AnnotationRegistry;
2525

26-
AnnotationRegistry::registerLoader(function ($class) use ($loader) {
27-
$loader->loadClass($class);
26+
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
27+
AnnotationRegistry::registerLoader(function ($class) use ($loader) {
28+
$loader->loadClass($class);
2829

29-
// this was class_exists($class, false) i.e. do not autoload.
30-
// this is required so that custom annotations (e.g. TreeUiBundle
31-
// annotations) are autoloaded - but they should be found by the
32-
// composer loader above.
33-
//
34-
// This probably slows things down.
35-
//
36-
// @todo: Fix me.
37-
return class_exists($class);
38-
});
30+
// this was class_exists($class, false) i.e. do not autoload.
31+
// this is required so that custom annotations (e.g. TreeUiBundle
32+
// annotations) are autoloaded - but they should be found by the
33+
// composer loader above.
34+
//
35+
// This probably slows things down.
36+
//
37+
// @todo: Fix me.
38+
return class_exists($class);
39+
});
40+
}
3941

4042
if (!defined('CMF_TEST_ROOT_DIR')) {
4143
define('CMF_TEST_ROOT_DIR', realpath(__DIR__.'/..'));

0 commit comments

Comments
 (0)