diff --git a/src/DependencyInjection/Compiler/PropertyInfoPass.php b/src/DependencyInjection/Compiler/PropertyInfoPass.php index 5d0a142..1a2f1e8 100644 --- a/src/DependencyInjection/Compiler/PropertyInfoPass.php +++ b/src/DependencyInjection/Compiler/PropertyInfoPass.php @@ -20,8 +20,6 @@ public function process(ContainerBuilder $container): void return; } - $propertyInfoDefinition = $container->findDefinition('property_info'); - $container->setDefinition( 'automapper.property_info.reflection_extractor.inner', new Definition( @@ -47,11 +45,22 @@ public function process(ContainerBuilder $container): void new Definition( PropertyInfoExtractor::class, [ - $this->replaceReflectionExtractor($propertyInfoDefinition->getArgument(0)), - $this->replaceReflectionExtractor($propertyInfoDefinition->getArgument(1)), - $this->replaceReflectionExtractor($propertyInfoDefinition->getArgument(2)), - $this->replaceReflectionExtractor($propertyInfoDefinition->getArgument(3)), - $this->replaceReflectionExtractor($propertyInfoDefinition->getArgument(4)), + new IteratorArgument([ + new Reference('automapper.property_info.reflection_extractor'), + ]), + new IteratorArgument([ + new Reference('property_info.phpstan_extractor'), + new Reference('automapper.property_info.reflection_extractor'), + ]), + new IteratorArgument([ + new Reference('automapper.property_info.reflection_extractor'), + ]), + new IteratorArgument([ + new Reference('automapper.property_info.reflection_extractor'), + ]), + new IteratorArgument([ + new Reference('automapper.property_info.reflection_extractor'), + ]), ] ) ); @@ -64,18 +73,4 @@ public function process(ContainerBuilder $container): void ]) )->setDecoratedService('automapper.property_info'); } - - private function replaceReflectionExtractor(IteratorArgument $extractors): IteratorArgument - { - $newExtractors = []; - - /** @var Reference $extractor */ - foreach ($extractors->getValues() as $extractor) { - $newExtractors[] = (string) $extractor === 'property_info.reflection_extractor' - ? new Reference('automapper.property_info.reflection_extractor') - : $extractor; - } - - return new IteratorArgument($newExtractors); - } }