Skip to content

Commit 32645c5

Browse files
committed
[Twig] throw error if twig-bundle is not installed
1 parent 6e87ef5 commit 32645c5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
1717
use Symfony\Component\DependencyInjection\ChildDefinition;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
19+
use Symfony\Component\DependencyInjection\Exception\LogicException;
1920
use Symfony\Component\DependencyInjection\Extension\Extension;
2021
use Symfony\Component\DependencyInjection\Reference;
2122
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
@@ -36,6 +37,10 @@ final class TwigComponentExtension extends Extension
3637
{
3738
public function load(array $configs, ContainerBuilder $container): void
3839
{
40+
if (!isset($container->getParameter('kernel.bundles')['TwigBundle'])) {
41+
throw new LogicException('symfony/ux-twig-component requires symfony/twig-bundle. Install with composer require symfony/twig-bundle.');
42+
}
43+
3944
$container->registerAttributeForAutoconfiguration(
4045
AsTwigComponent::class,
4146
static function (ChildDefinition $definition, AsTwigComponent $attribute) {

0 commit comments

Comments
 (0)