From eff2f569f59519ce19d0d3ef87c44bd7953282fe Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 29 Aug 2026 08:58:30 +0200 Subject: [PATCH] Complete IncludeNode template parameter signature --- CHANGELOG | 1 + phpstan-baseline.neon | 6 ------ src/Node/IncludeNode.php | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1c1059f50b7..91d99d5a14c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ # 4.0.0 (2026-XX-XX) + * Add an optional `string $template = ''` argument to `IncludeNode::addGetTemplate()`; subclasses overriding this method must declare a compatible parameter * Remove `TemplateVariable` and `AssignTemplateVariable`; use `MacroVariable` and `AssignMacroVariable` instead * Add the `isAlwaysAllowedInSandbox()` method to `Twig\TwigCallableInterface` and `Twig\TokenParser\TokenParserInterface` * Always allow printing a `Markup` object in a sandbox, whatever the security policy is diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3511d717c1b..f684dcd6dd8 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,11 +1,5 @@ parameters: ignoreErrors: - - # 2 parameters will be required - message: '#^Method Twig\\Node\\IncludeNode\:\:addGetTemplate\(\) invoked with 2 parameters, 1 required\.$#' - identifier: arguments.count - count: 1 - path: src/Node/IncludeNode.php - - # Adding 0 to the string representation of a number is valid and what we want here message: '#^Binary operation "\+" between 0 and string results in an error\.$#' identifier: binaryOp.invalid diff --git a/src/Node/IncludeNode.php b/src/Node/IncludeNode.php index 9d4fe664ba6..5d09ca8bf0e 100644 --- a/src/Node/IncludeNode.php +++ b/src/Node/IncludeNode.php @@ -79,7 +79,7 @@ public function compile(Compiler $compiler): void } } - protected function addGetTemplate(Compiler $compiler/* , string $template = '' */): void + protected function addGetTemplate(Compiler $compiler, string $template = ''): void { $compiler ->raw('$this->load(')