Skip to content

Commit fe2daf6

Browse files
committed
remove check for existence of registerAttributeForAutoconfiguration
1 parent 2250753 commit fe2daf6

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

src/LiveComponent/src/DependencyInjection/LiveComponentExtension.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,19 @@ final class LiveComponentExtension extends Extension
3838
{
3939
public function load(array $configs, ContainerBuilder $container): void
4040
{
41-
if (method_exists($container, 'registerAttributeForAutoconfiguration')) {
42-
$container->registerAttributeForAutoconfiguration(
43-
AsLiveComponent::class,
44-
function (ChildDefinition $definition, AsLiveComponent $attribute) {
45-
$definition
46-
->addTag('twig.component', array_filter([
47-
'key' => $attribute->name,
48-
'template' => $attribute->template,
49-
'default_action' => $attribute->defaultAction,
50-
]))
51-
->addTag('controller.service_arguments')
52-
;
53-
}
54-
);
55-
}
41+
$container->registerAttributeForAutoconfiguration(
42+
AsLiveComponent::class,
43+
function (ChildDefinition $definition, AsLiveComponent $attribute) {
44+
$definition
45+
->addTag('twig.component', array_filter([
46+
'key' => $attribute->name,
47+
'template' => $attribute->template,
48+
'default_action' => $attribute->defaultAction,
49+
]))
50+
->addTag('controller.service_arguments')
51+
;
52+
}
53+
);
5654

5755
$container->registerForAutoconfiguration(PropertyHydratorInterface::class)
5856
->addTag('twig.component.property_hydrator')

src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ final class TwigComponentExtension extends Extension
3434
{
3535
public function load(array $configs, ContainerBuilder $container): void
3636
{
37-
if (method_exists($container, 'registerAttributeForAutoconfiguration')) {
38-
$container->registerAttributeForAutoconfiguration(
39-
AsTwigComponent::class,
40-
static function (ChildDefinition $definition, AsTwigComponent $attribute) {
41-
$definition->addTag('twig.component', array_filter([
42-
'key' => $attribute->name,
43-
'template' => $attribute->template,
44-
]));
45-
}
46-
);
47-
}
37+
$container->registerAttributeForAutoconfiguration(
38+
AsTwigComponent::class,
39+
static function (ChildDefinition $definition, AsTwigComponent $attribute) {
40+
$definition->addTag('twig.component', array_filter([
41+
'key' => $attribute->name,
42+
'template' => $attribute->template,
43+
]));
44+
}
45+
);
4846

4947
$container->register('ux.twig_component.component_factory', ComponentFactory::class)
5048
->setArguments([

0 commit comments

Comments
 (0)