futtern/config/packages/twig.php

17 lines
434 B
PHP
Raw Normal View History

2024-02-05 15:16:43 +00:00
<?php declare(strict_types=1);
2024-02-13 22:02:22 +00:00
use App\Service\WhoAreYou;
2024-02-12 21:03:17 +00:00
// config/packages/twig.php
use Symfony\Config\TwigConfig;
2024-02-05 15:16:43 +00:00
2024-02-12 21:03:17 +00:00
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
2024-02-05 15:16:43 +00:00
2024-02-12 21:03:17 +00:00
return static function (TwigConfig $twig): void {
2024-02-13 22:02:22 +00:00
$twig->fileNamePattern('*.twig')
2024-02-12 21:03:17 +00:00
->global('username', service(WhoAreYou::class));
if ($_SERVER['APP_ENV'] === 'test') {
$twig->strictVariables(true);
2024-02-05 15:16:43 +00:00
}
};