futtern/config/packages/twig.php
2024-02-13 23:02:22 +01:00

16 lines
434 B
PHP

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