From 99508ab225e97bd084db674ad497f0559d1e71f8 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Thu, 19 Mar 2020 12:28:14 +0100 Subject: [PATCH] Avoid failing test classes extending from AbstractSonataAdminExtension --- src/DependencyInjection/AbstractSonataAdminExtension.php | 4 +++- src/Twig/Extension/IntlExtension.php | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/DependencyInjection/AbstractSonataAdminExtension.php b/src/DependencyInjection/AbstractSonataAdminExtension.php index 3786ab059af..1cf5724b595 100644 --- a/src/DependencyInjection/AbstractSonataAdminExtension.php +++ b/src/DependencyInjection/AbstractSonataAdminExtension.php @@ -78,7 +78,9 @@ protected function fixTemplatesConfiguration( ], ]; - $useIntlTemplates = $container->getParameter('sonata.admin.configuration.use_intl_templates'); + $useIntlTemplates = $container->hasParameter('sonata.admin.configuration.use_intl_templates') + ? $container->getParameter('sonata.admin.configuration.use_intl_templates') + : false; if ($useIntlTemplates) { $defaultConfig['templates']['types']['list'] = array_merge($defaultConfig['templates']['types']['list'], [ diff --git a/src/Twig/Extension/IntlExtension.php b/src/Twig/Extension/IntlExtension.php index c833a1aee93..049850313d9 100644 --- a/src/Twig/Extension/IntlExtension.php +++ b/src/Twig/Extension/IntlExtension.php @@ -23,6 +23,9 @@ */ final class IntlExtension extends AbstractExtension { + /** + * @var TwigIntlExtension + */ private $extension; public function __construct(TwigIntlExtension $extension) @@ -30,10 +33,9 @@ public function __construct(TwigIntlExtension $extension) $this->extension = $extension; } - public function getFilters() + public function getFilters(): array { return [ - // localized formatters new TwigFilter('sonata_format_currency', [$this, 'formatCurrency']), new TwigFilter('sonata_format_number', [$this, 'formatNumber']), new TwigFilter('sonata_format_datetime', [$this, 'formatDateTime'], ['needs_environment' => true]),