Skip to content

Commit 9c119c8

Browse files
authored
Merge pull request #213 from alexander-schranz/patch-1
Call AnnotationRegistry registerLoader only when available
2 parents 5953011 + 2851bff commit 9c119c8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/test-application.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151

5252
- name: Install Symfony Flex
5353
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
54+
55+
- name: Allow Symfony Flex Plugin
56+
run: composer global config --no-plugins allow-plugins.symfony/flex true
5457

5558
- name: Install dependencies with Composer
5659
uses: ramsey/composer-install@v1

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)