diff --git a/bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php b/bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php index 2110eeeac..984295047 100644 --- a/bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php +++ b/bundles/LayoutsBundle/Templating/Twig/Node/DefaultContext.php @@ -6,6 +6,7 @@ use Twig\Attribute\YieldReady; use Twig\Compiler; +use Twig\Environment; use Twig\Node\Expression\AbstractExpression; use Twig\Node\Node; @@ -14,7 +15,9 @@ final class DefaultContext extends Node { public function __construct(AbstractExpression $expr, int $line = 0, ?string $tag = null) { - parent::__construct(['expr' => $expr], [], $line, $tag); + Environment::MAJOR_VERSION === 3 && Environment::MINOR_VERSION < 12 ? + parent::__construct(['expr' => $expr], [], $line, $tag) : + parent::__construct(['expr' => $expr], [], $line); } public function compile(Compiler $compiler): void diff --git a/bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php b/bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php index 3ddeca6b1..cf7a3e2a2 100644 --- a/bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php +++ b/bundles/LayoutsBundle/Templating/Twig/Node/RenderZone.php @@ -26,7 +26,9 @@ public function __construct(AbstractExpression $zone, ?AbstractExpression $conte $nodes['context'] = $context; } - parent::__construct($nodes, [], $line, $tag); + Environment::MAJOR_VERSION === 3 && Environment::MINOR_VERSION < 12 ? + parent::__construct($nodes, [], $line, $tag) : + parent::__construct($nodes, [], $line); } public function compile(Compiler $compiler): void diff --git a/phpstan.neon b/phpstan.neon index d92fd4f74..b094ddc1d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,6 +8,8 @@ parameters: dynamicConstantNames: - Symfony\Component\HttpKernel\Kernel::VERSION_ID - Twig\Environment::VERSION_ID + - Twig\Environment::MAJOR_VERSION + - Twig\Environment::MINOR_VERSION ignoreErrors: # Doctrine DBAL