Skip to content

Commit 79dba90

Browse files
committed
Compatibility with doctrine/annotations 2
1 parent ec92f91 commit 79dba90

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,8 +1632,12 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16321632
$loader->load('annotations.php');
16331633

16341634
if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
1635-
$container->getDefinition('annotations.dummy_registry')
1636-
->setMethodCalls([['registerLoader', ['class_exists']]]);
1635+
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
1636+
$container->getDefinition('annotations.dummy_registry')
1637+
->setMethodCalls([['registerLoader', ['class_exists']]]);
1638+
} else {
1639+
$container->removeDefinition('annotations.dummy_registry');
1640+
}
16371641
}
16381642

16391643
if ('none' === $config['cache']) {

Resources/config/annotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
->set('annotations.reader', AnnotationReader::class)
2727
->call('addGlobalIgnoredName', [
2828
'required',
29-
service('annotations.dummy_registry'), // dummy arg to register class_exists as annotation loader only when required
29+
service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
3030
])
3131

3232
->set('annotations.dummy_registry', AnnotationRegistry::class)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"symfony/routing": "^5.3|^6.0"
3535
},
3636
"require-dev": {
37-
"doctrine/annotations": "^1.13.1",
37+
"doctrine/annotations": "^1.13.1|^2",
3838
"doctrine/cache": "^1.11|^2.0",
3939
"doctrine/persistence": "^1.3|^2|^3",
4040
"symfony/asset": "^5.3|^6.0",

0 commit comments

Comments
 (0)