Enforce more type hints

This commit is contained in:
Fabien Potencier
2024-08-24 10:51:35 +02:00
parent b858e61ddb
commit dfd9d0faad
2 changed files with 2 additions and 16 deletions
+1 -8
View File
@@ -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());