Skip to content

Commit 34e89d4

Browse files
committed
Use ::class instead of FQCN
1 parent cd6d35f commit 34e89d4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

DependencyInjection/Compiler/DataCollectorTranslatorPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\Translation\TranslatorBagInterface;
1617

1718
/**
1819
* @author Christian Flothmann <[email protected]>
@@ -27,7 +28,7 @@ public function process(ContainerBuilder $container)
2728

2829
$translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass());
2930

30-
if (!is_subclass_of($translatorClass, 'Symfony\Component\Translation\TranslatorBagInterface')) {
31+
if (!is_subclass_of($translatorClass, TranslatorBagInterface::class)) {
3132
$container->removeDefinition('translator.data_collector');
3233
$container->removeDefinition('data_collector.translation');
3334
}

DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
use Symfony\Component\Notifier\Recipient\Recipient;
164164
use Symfony\Component\Notifier\Transport\TransportFactoryInterface as NotifierTransportFactoryInterface;
165165
use Symfony\Component\PropertyAccess\PropertyAccessor;
166+
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
166167
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
167168
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
168169
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
@@ -182,6 +183,9 @@
182183
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
183184
use Symfony\Component\Serializer\Encoder\DecoderInterface;
184185
use Symfony\Component\Serializer\Encoder\EncoderInterface;
186+
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
187+
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
188+
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
185189
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
186190
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
187191
use Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer;
@@ -510,7 +514,7 @@ public function load(array $configs, ContainerBuilder $container)
510514
'**\\Entity\\',
511515

512516
// Added explicitly so that we don't rely on the class map being dumped to make it work
513-
'Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController',
517+
AbstractController::class,
514518
]);
515519

516520
if (ContainerBuilder::willBeAvailable('symfony/mime', MimeTypes::class, ['symfony/framework-bundle'])) {
@@ -1731,7 +1735,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
17311735
$serializerLoaders = [];
17321736
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
17331737
$annotationLoader = new Definition(
1734-
'Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader',
1738+
AnnotationLoader::class,
17351739
[new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]
17361740
);
17371741
$annotationLoader->setPublic(false);
@@ -1740,7 +1744,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
17401744
}
17411745

17421746
$fileRecorder = function ($extension, $path) use (&$serializerLoaders) {
1743-
$definition = new Definition(\in_array($extension, ['yaml', 'yml']) ? 'Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader' : 'Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', [$path]);
1747+
$definition = new Definition(\in_array($extension, ['yaml', 'yml']) ? YamlFileLoader::class : XmlFileLoader::class, [$path]);
17441748
$definition->setPublic(false);
17451749
$serializerLoaders[] = $definition;
17461750
};
@@ -1813,7 +1817,7 @@ private function registerPropertyInfoConfiguration(ContainerBuilder $container,
18131817
}
18141818

18151819
if (ContainerBuilder::willBeAvailable('phpdocumentor/reflection-docblock', DocBlockFactoryInterface::class, ['symfony/framework-bundle', 'symfony/property-info'], true)) {
1816-
$definition = $container->register('property_info.php_doc_extractor', 'Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor');
1820+
$definition = $container->register('property_info.php_doc_extractor', PhpDocExtractor::class);
18171821
$definition->addTag('property_info.description_extractor', ['priority' => -1000]);
18181822
$definition->addTag('property_info.type_extractor', ['priority' => -1001]);
18191823
}

0 commit comments

Comments
 (0)