mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-04 19:07:11 +00:00
Rename macro variable AST nodes
This commit is contained in:
+7
-7
@@ -24,8 +24,8 @@ use Twig\Node\BlockReferenceNode;
|
||||
use Twig\Node\BodyNode;
|
||||
use Twig\Node\EmptyNode;
|
||||
use Twig\Node\Expression\AbstractExpression;
|
||||
use Twig\Node\Expression\Variable\AssignTemplateVariable;
|
||||
use Twig\Node\Expression\Variable\TemplateVariable;
|
||||
use Twig\Node\Expression\Variable\AssignMacroVariable;
|
||||
use Twig\Node\Expression\Variable\MacroVariable;
|
||||
use Twig\Node\MacroNode;
|
||||
use Twig\Node\ModuleNode;
|
||||
use Twig\Node\Node;
|
||||
@@ -329,19 +329,19 @@ class Parser
|
||||
$this->embeddedTemplates[] = $template;
|
||||
}
|
||||
|
||||
public function addImportedSymbol(string $type, string $alias, ?string $name = null, AbstractExpression|AssignTemplateVariable|null $internalRef = null): void
|
||||
public function addImportedSymbol(string $type, string $alias, ?string $name = null, AbstractExpression|AssignMacroVariable|null $internalRef = null): void
|
||||
{
|
||||
if ($internalRef && !$internalRef instanceof AssignTemplateVariable) {
|
||||
trigger_deprecation('twig/twig', '3.15', 'Not passing a "%s" instance as an internal reference is deprecated ("%s" given).', __METHOD__, AssignTemplateVariable::class, $internalRef::class);
|
||||
if ($internalRef && !$internalRef instanceof AssignMacroVariable) {
|
||||
trigger_deprecation('twig/twig', '3.15', 'Not passing a "%s" instance as an internal reference is deprecated ("%s" given).', __METHOD__, AssignMacroVariable::class, $internalRef::class);
|
||||
|
||||
$internalRef = new AssignTemplateVariable(new TemplateVariable($internalRef->getAttribute('name'), $internalRef->getTemplateLine()), $internalRef->getAttribute('global'));
|
||||
$internalRef = new AssignMacroVariable(new MacroVariable($internalRef->getAttribute('name'), $internalRef->getTemplateLine()), $internalRef->getAttribute('global'));
|
||||
}
|
||||
|
||||
$this->importedSymbols[0][$type][$alias] = ['name' => $name, 'node' => $internalRef];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{name: string, node: AssignTemplateVariable|null}|null
|
||||
* @return array{name: string, node: AssignMacroVariable|null}|null
|
||||
*/
|
||||
public function getImportedSymbol(string $type, string $alias)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user