mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-10 13:55:37 +00:00
Rename macro variable AST nodes
This commit is contained in:
@@ -14,8 +14,9 @@ namespace Twig\Node;
|
||||
use Twig\Attribute\YieldReady;
|
||||
use Twig\Compiler;
|
||||
use Twig\Node\Expression\AbstractExpression;
|
||||
use Twig\Node\Expression\Variable\AssignTemplateVariable;
|
||||
use Twig\Node\Expression\Variable\AssignMacroVariable;
|
||||
use Twig\Node\Expression\Variable\ContextVariable;
|
||||
use Twig\Node\Expression\Variable\MacroVariable;
|
||||
|
||||
/**
|
||||
* Represents an import node.
|
||||
@@ -25,16 +26,16 @@ use Twig\Node\Expression\Variable\ContextVariable;
|
||||
#[YieldReady]
|
||||
class ImportNode extends Node implements CoercesChildrenToStringInterface
|
||||
{
|
||||
public function __construct(AbstractExpression $expr, AbstractExpression|AssignTemplateVariable $var, int $lineno)
|
||||
public function __construct(AbstractExpression $expr, AbstractExpression|AssignMacroVariable $var, int $lineno)
|
||||
{
|
||||
if (\func_num_args() > 3) {
|
||||
trigger_deprecation('twig/twig', '3.15', \sprintf('Passing more than 3 arguments to "%s()" is deprecated.', __METHOD__));
|
||||
}
|
||||
|
||||
if (!$var instanceof AssignTemplateVariable) {
|
||||
trigger_deprecation('twig/twig', '3.15', \sprintf('Passing a "%s" instance as the second argument of "%s" is deprecated, pass a "%s" instead.', $var::class, __CLASS__, AssignTemplateVariable::class));
|
||||
if (!$var instanceof AssignMacroVariable) {
|
||||
trigger_deprecation('twig/twig', '3.15', \sprintf('Passing a "%s" instance as the second argument of "%s" is deprecated, pass a "%s" instead.', $var::class, __CLASS__, AssignMacroVariable::class));
|
||||
|
||||
$var = new AssignTemplateVariable($var->getAttribute('name'), $lineno);
|
||||
$var = new AssignMacroVariable(new MacroVariable($var->getAttribute('name'), $lineno));
|
||||
}
|
||||
|
||||
parent::__construct(['expr' => $expr, 'var' => $var], [], $lineno);
|
||||
|
||||
Reference in New Issue
Block a user