Skip to content

Commit 9817abd

Browse files
committed
use AbstractArgument if available
1 parent 917e4d4 commit 9817abd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\LiveComponent\DependencyInjection;
1313

14+
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
1415
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
1516
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -21,6 +22,7 @@
2122
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
2223
use Symfony\UX\LiveComponent\ComponentValidator;
2324
use Symfony\UX\LiveComponent\ComponentValidatorInterface;
25+
use Symfony\UX\LiveComponent\DependencyInjection\Compiler\LiveComponentPass;
2426
use Symfony\UX\LiveComponent\EventListener\LiveComponentSubscriber;
2527
use Symfony\UX\LiveComponent\Hydrator\DoctrineEntityPropertyHydrator;
2628
use Symfony\UX\LiveComponent\Hydrator\NormalizerBridgePropertyHydrator;
@@ -72,6 +74,9 @@ public function load(array $configs, ContainerBuilder $container): void
7274
;
7375

7476
$container->register('ux.live_component.event_subscriber', LiveComponentSubscriber::class)
77+
->setArguments([
78+
class_exists(AbstractArgument::class) ? new AbstractArgument(sprintf('Added in %s.', LiveComponentPass::class)) : [],
79+
])
7580
->addTag('kernel.event_subscriber')
7681
->addTag('container.service_subscriber', ['key' => ComponentFactory::class, 'id' => 'ux.twig_component.component_factory'])
7782
->addTag('container.service_subscriber', ['key' => ComponentRenderer::class, 'id' => 'ux.twig_component.component_renderer'])

src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\TwigComponent\DependencyInjection;
1313

14+
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
1415
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
1516
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -19,6 +20,7 @@
1920
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
2021
use Symfony\UX\TwigComponent\ComponentFactory;
2122
use Symfony\UX\TwigComponent\ComponentRenderer;
23+
use Symfony\UX\TwigComponent\DependencyInjection\Compiler\TwigComponentPass;
2224
use Symfony\UX\TwigComponent\Twig\ComponentExtension;
2325
use Symfony\UX\TwigComponent\Twig\ComponentRuntime;
2426

@@ -42,7 +44,7 @@ static function (ChildDefinition $definition) {
4244

4345
$container->register('ux.twig_component.component_factory', ComponentFactory::class)
4446
->setArguments([
45-
new ServiceLocatorArgument(), // set in compiler pass
47+
class_exists(AbstractArgument::class) ? new AbstractArgument(sprintf('Added in %s.', TwigComponentPass::class)) : new ServiceLocatorArgument(),
4648
new Reference('property_accessor'),
4749
])
4850
;

0 commit comments

Comments
 (0)