N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)

* Update Symfony lib to version ~6.4.0
* Update code missing return type
* Add an iTop general configuration entry to store application secret (Symfony mandatory parameter)
* Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -13,6 +13,7 @@ namespace Symfony\Bundle\TwigBundle\DependencyInjection\Configurator;
use Symfony\Bridge\Twig\UndefinedCallableHandler;
use Twig\Environment;
use Twig\Extension\CoreExtension;
// BC/FC with namespaced Twig
class_exists(Environment::class);
@@ -24,12 +25,12 @@ class_exists(Environment::class);
*/
class EnvironmentConfigurator
{
private $dateFormat;
private $intervalFormat;
private $timezone;
private $decimals;
private $decimalPoint;
private $thousandsSeparator;
private string $dateFormat;
private string $intervalFormat;
private ?string $timezone;
private int $decimals;
private string $decimalPoint;
private string $thousandsSeparator;
public function __construct(string $dateFormat, string $intervalFormat, ?string $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator)
{
@@ -41,18 +42,21 @@ class EnvironmentConfigurator
$this->thousandsSeparator = $thousandsSeparator;
}
/**
* @return void
*/
public function configure(Environment $environment)
{
$environment->getExtension('Twig\Extension\CoreExtension')->setDateFormat($this->dateFormat, $this->intervalFormat);
$environment->getExtension(CoreExtension::class)->setDateFormat($this->dateFormat, $this->intervalFormat);
if (null !== $this->timezone) {
$environment->getExtension('Twig\Extension\CoreExtension')->setTimezone($this->timezone);
$environment->getExtension(CoreExtension::class)->setTimezone($this->timezone);
}
$environment->getExtension('Twig\Extension\CoreExtension')->setNumberFormat($this->decimals, $this->decimalPoint, $this->thousandsSeparator);
$environment->getExtension(CoreExtension::class)->setNumberFormat($this->decimals, $this->decimalPoint, $this->thousandsSeparator);
// wrap UndefinedCallableHandler in closures for lazy-autoloading
$environment->registerUndefinedFilterCallback(function ($name) { return UndefinedCallableHandler::onUndefinedFilter($name); });
$environment->registerUndefinedFunctionCallback(function ($name) { return UndefinedCallableHandler::onUndefinedFunction($name); });
$environment->registerUndefinedFilterCallback(fn ($name) => UndefinedCallableHandler::onUndefinedFilter($name));
$environment->registerUndefinedFunctionCallback(fn ($name) => UndefinedCallableHandler::onUndefinedFunction($name));
}
}