futtern/config/packages/twig.php
2024-02-12 22:03:17 +01:00

18 lines
444 B
PHP

<?php declare(strict_types=1);
// config/packages/twig.php
use Symfony\Config\TwigConfig;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use App\Service\WhoAreYou;
return static function (TwigConfig $twig): void {
$twig
->fileNamePattern('*.twig')
->global('username', service(WhoAreYou::class));
if ($_SERVER['APP_ENV'] === 'test') {
$twig->strictVariables(true);
}
};