Skip to content

Commit a77042a

Browse files
minor #48725 Remove calls to AnnotationRegistry::registerLoader() (derrabus)
This PR was merged into the 6.3 branch. Discussion ---------- Remove calls to `AnnotationRegistry::registerLoader()` | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | N/A | License | MIT | Doc PR | N/A Calling `AnnotationRegistry::registerLoader()` should not be necessary anymore since Annotations 1.10 (April 2020), as long as all annotations are autoloadable. Let's remove all calls to that method. Commits ------- c0e9ee16eb Remove calls to AnnotationRegistry::registerLoader()
2 parents c11c1c6 + 0544bc5 commit a77042a

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
use Composer\InstalledVersions;
15-
use Doctrine\Common\Annotations\AnnotationRegistry;
1615
use Doctrine\Common\Annotations\Reader;
1716
use Http\Client\HttpClient;
1817
use phpDocumentor\Reflection\DocBlockFactoryInterface;
@@ -1643,15 +1642,6 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16431642

16441643
$loader->load('annotations.php');
16451644

1646-
if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
1647-
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
1648-
$container->getDefinition('annotations.dummy_registry')
1649-
->setMethodCalls([['registerLoader', ['class_exists']]]);
1650-
} else {
1651-
$container->removeDefinition('annotations.dummy_registry');
1652-
}
1653-
}
1654-
16551645
if ('none' === $config['cache']) {
16561646
$container->removeDefinition('annotations.cached_reader');
16571647

Resources/config/annotations.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
use Doctrine\Common\Annotations\AnnotationReader;
15-
use Doctrine\Common\Annotations\AnnotationRegistry;
1615
use Doctrine\Common\Annotations\PsrCachedReader;
1716
use Doctrine\Common\Annotations\Reader;
1817
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
@@ -23,13 +22,7 @@
2322
return static function (ContainerConfigurator $container) {
2423
$container->services()
2524
->set('annotations.reader', AnnotationReader::class)
26-
->call('addGlobalIgnoredName', [
27-
'required',
28-
service('annotations.dummy_registry')->ignoreOnInvalid(), // dummy arg to register class_exists as annotation loader only when required
29-
])
30-
31-
->set('annotations.dummy_registry', AnnotationRegistry::class)
32-
->call('registerUniqueLoader', ['class_exists'])
25+
->call('addGlobalIgnoredName', ['required'])
3326

3427
->set('annotations.cached_reader', PsrCachedReader::class)
3528
->args([

0 commit comments

Comments
 (0)