Skip to content

Commit 60df674

Browse files
qneyratfabpot
authored andcommitted
[PropertyInfo] Move configuration to PHP
1 parent 8692d14 commit 60df674

File tree

3 files changed

+55
-43
lines changed

3 files changed

+55
-43
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ public function load(array $configs, ContainerBuilder $container)
386386
}
387387

388388
if ($propertyInfoEnabled) {
389-
$this->registerPropertyInfoConfiguration($container, $loader);
389+
$this->registerPropertyInfoConfiguration($container, $phpLoader);
390390
}
391391

392392
if ($this->isConfigEnabled($container, $config['lock'])) {
@@ -1548,13 +1548,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
15481548
}
15491549
}
15501550

1551-
private function registerPropertyInfoConfiguration(ContainerBuilder $container, XmlFileLoader $loader)
1551+
private function registerPropertyInfoConfiguration(ContainerBuilder $container, PhpFileLoader $loader)
15521552
{
15531553
if (!interface_exists(PropertyInfoExtractorInterface::class)) {
15541554
throw new LogicException('PropertyInfo support cannot be enabled as the PropertyInfo component is not installed. Try running "composer require symfony/property-info".');
15551555
}
15561556

1557-
$loader->load('property_info.xml');
1557+
$loader->load('property_info.php');
15581558

15591559
if (interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) {
15601560
$definition = $container->register('property_info.php_doc_extractor', 'Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor');

Resources/config/property_info.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
15+
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
16+
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
17+
use Symfony\Component\PropertyInfo\PropertyInfoCacheExtractor;
18+
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
19+
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
20+
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
21+
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
22+
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface;
23+
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
24+
use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface;
25+
26+
return static function (ContainerConfigurator $container) {
27+
$container->services()
28+
->set('property_info', PropertyInfoExtractor::class)
29+
->args([[], [], [], [], []])
30+
31+
->alias(PropertyAccessExtractorInterface::class, 'property_info')
32+
->alias(PropertyDescriptionExtractorInterface::class, 'property_info')
33+
->alias(PropertyInfoExtractorInterface::class, 'property_info')
34+
->alias(PropertyTypeExtractorInterface::class, 'property_info')
35+
->alias(PropertyListExtractorInterface::class, 'property_info')
36+
->alias(PropertyInitializableExtractorInterface::class, 'property_info')
37+
38+
->set('property_info.cache', PropertyInfoCacheExtractor::class)
39+
->decorate('property_info')
40+
->args([service('property_info.cache.inner'), service('cache.property_info')])
41+
42+
// Extractor
43+
->set('property_info.reflection_extractor', ReflectionExtractor::class)
44+
->tag('property_info.list_extractor', ['priority' => -1000])
45+
->tag('property_info.type_extractor', ['priority' => -1002])
46+
->tag('property_info.access_extractor', ['priority' => -1000])
47+
->tag('property_info.initializable_extractor', ['priority' => -1000])
48+
49+
->alias(PropertyReadInfoExtractorInterface::class, 'property_info.reflection_extractor')
50+
->alias(PropertyWriteInfoExtractorInterface::class, 'property_info.reflection_extractor')
51+
;
52+
};

Resources/config/property_info.xml

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)