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

@@ -23,7 +23,7 @@ use Twig\Environment;
*/
class TemplateController
{
private $twig;
private ?Environment $twig;
public function __construct(Environment $twig = null)
{
@@ -38,12 +38,12 @@ class TemplateController
* @param int|null $sharedAge Max age for shared (proxy) caching
* @param bool|null $private Whether or not caching should apply for client caches only
* @param array $context The context (arguments) of the template
* @param int $statusCode The HTTP status code to return with the response. Defaults to 200
* @param int $statusCode The HTTP status code to return with the response (200 "OK" by default)
*/
public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
{
if (null === $this->twig) {
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available.');
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
}
$response = new Response($this->twig->render($template, $context), $statusCode);
@@ -65,6 +65,9 @@ class TemplateController
return $response;
}
/**
* @param int $statusCode The HTTP status code (200 "OK" by default)
*/
public function __invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
{
return $this->templateAction($template, $maxAge, $sharedAge, $private, $context, $statusCode);