Skip to content

Commit

Permalink
Avoid failing test classes extending from AbstractSonataAdminExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Mar 19, 2020
1 parent 789c660 commit 99508ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/DependencyInjection/AbstractSonataAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'], [
Expand Down
6 changes: 4 additions & 2 deletions src/Twig/Extension/IntlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@
*/
final class IntlExtension extends AbstractExtension
{
/**
* @var TwigIntlExtension
*/
private $extension;

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]),
Expand Down

0 comments on commit 99508ab

Please sign in to comment.