From 41fd0a881e31a2e7e0efc0fc0a0e52096f6c1338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 2 Oct 2018 17:56:33 +0200 Subject: [PATCH] [FWBundle] Throw if PropertyInfo is enabled, but the component isn't installed --- .../DependencyInjection/FrameworkExtension.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index c36b85cc9a..6b33715ab6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -61,6 +61,7 @@ use Symfony\Component\Lock\StoreInterface; use Symfony\Component\PropertyAccess\PropertyAccessor; use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface; use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface; +use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface; use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; @@ -296,7 +297,7 @@ class FrameworkExtension extends Extension } if ($this->isConfigEnabled($container, $config['property_info'])) { - $this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader); + $this->registerPropertyInfoConfiguration($container, $loader); } if ($this->isConfigEnabled($container, $config['lock'])) { @@ -1543,8 +1544,12 @@ class FrameworkExtension extends Extension } } - private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) + private function registerPropertyInfoConfiguration(ContainerBuilder $container, XmlFileLoader $loader) { + if (!interface_exists(PropertyInfoExtractorInterface::class)) { + throw new LogicException('PropertyInfo support cannot be enabled as the PropertyInfo component is not installed. Try running "composer require symfony/property-info".'); + } + $loader->load('property_info.xml'); $container->getDefinition('property_info')->setPrivate(true);