Complete IncludeNode template parameter signature

This commit is contained in:
Fabien Potencier
2026-08-29 08:58:30 +02:00
parent 4b63bb1baa
commit eff2f569f5
3 changed files with 2 additions and 7 deletions
+1
View File
@@ -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
-6
View File
@@ -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
+1 -1
View File
@@ -79,7 +79,7 @@ class IncludeNode extends Node implements NodeOutputInterface, CoercesChildrenTo
}
}
protected function addGetTemplate(Compiler $compiler/* , string $template = '' */): void
protected function addGetTemplate(Compiler $compiler, string $template = ''): void
{
$compiler
->raw('$this->load(')