Skip to content

Commit 467cf92

Browse files
dunglasfabpot
authored andcommitted
[PropertyInfo] Add an extractor to guess if a property is initializable
1 parent b7f7873 commit 467cf92

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
use Symfony\Component\PropertyAccess\PropertyAccessor;
7777
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
7878
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
79+
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
7980
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
8081
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
8182
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
@@ -347,6 +348,8 @@ public function load(array $configs, ContainerBuilder $container)
347348
->addTag('property_info.description_extractor');
348349
$container->registerForAutoconfiguration(PropertyAccessExtractorInterface::class)
349350
->addTag('property_info.access_extractor');
351+
$container->registerForAutoconfiguration(PropertyInitializableExtractorInterface::class)
352+
->addTag('property_info.initializable_extractor');
350353
$container->registerForAutoconfiguration(EncoderInterface::class)
351354
->addTag('serializer.encoder');
352355
$container->registerForAutoconfiguration(DecoderInterface::class)

Resources/config/property_info.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@
1212
<argument type="collection" />
1313
<argument type="collection" />
1414
<argument type="collection" />
15+
<argument type="collection" />
1516
</service>
1617
<service id="Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface" alias="property_info" />
1718
<service id="Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface" alias="property_info" />
1819
<service id="Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface" alias="property_info" />
1920
<service id="Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface" alias="property_info" />
2021
<service id="Symfony\Component\PropertyInfo\PropertyListExtractorInterface" alias="property_info" />
22+
<service id="Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface" alias="property_info" />
2123

2224
<!-- Extractor -->
2325
<service id="property_info.reflection_extractor" class="Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor">
2426
<tag name="property_info.list_extractor" priority="-1000" />
2527
<tag name="property_info.type_extractor" priority="-1002" />
2628
<tag name="property_info.access_extractor" priority="-1000" />
29+
<tag name="property_info.initializable_extractor" priority="-1000" />
2730
</service>
2831
</services>
2932
</container>

0 commit comments

Comments
 (0)