diff --git a/src/Node/MacroNode.php b/src/Node/MacroNode.php index 54a04ddc2..e4a73181a 100644 --- a/src/Node/MacroNode.php +++ b/src/Node/MacroNode.php @@ -25,15 +25,8 @@ class MacroNode extends Node { public const VARARGS_NAME = 'varargs'; - /** - * @param BodyNode $body - */ - public function __construct(string $name, Node $body, Node $arguments, int $lineno, ?string $tag = null) + public function __construct(string $name, BodyNode $body, Node $arguments, int $lineno, ?string $tag = null) { - if (!$body instanceof BodyNode) { - trigger_deprecation('twig/twig', '3.12', sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, __CLASS__)); - } - foreach ($arguments as $argumentName => $argument) { if (self::VARARGS_NAME === $argumentName) { throw new SyntaxError(\sprintf('The argument "%s" in macro "%s" cannot be defined because the variable "%s" is reserved for arbitrary arguments.', self::VARARGS_NAME, $name, self::VARARGS_NAME), $argument->getTemplateLine(), $argument->getSourceContext()); diff --git a/src/Node/ModuleNode.php b/src/Node/ModuleNode.php index de00f7583..a7de521a1 100644 --- a/src/Node/ModuleNode.php +++ b/src/Node/ModuleNode.php @@ -30,15 +30,8 @@ use Twig\Source; #[YieldReady] final class ModuleNode extends Node { - /** - * @param BodyNode $body - */ - public function __construct(Node $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) + public function __construct(BodyNode $body, ?AbstractExpression $parent, Node $blocks, Node $macros, Node $traits, $embeddedTemplates, Source $source) { - if (!$body instanceof BodyNode) { - trigger_deprecation('twig/twig', '3.12', sprintf('Not passing a "%s" instance as the "body" argument of the "%s" constructor is deprecated.', BodyNode::class, __CLASS__)); - } - $nodes = [ 'body' => $body, 'blocks' => $blocks,