Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public function hasMacro(string $name): bool
public function setMacro(string $name, MacroNode $node): void
{
if (isset($this->macros[$name])) {
trigger_deprecation('twig/twig', '3.29', 'Defining the macro "%s" more than once in "%s" is deprecated and will throw a SyntaxError in Twig 4.0 (first definition at line %d, second at line %d).', $name, $this->stream->getSourceContext()->getName(), $this->macros[$name]->getTemplateLine(), $node->getTemplateLine());
trigger_deprecation('twig/twig', '3.29', 'Defining the macro "%s" more than once in "%s" is deprecated and will throw a SyntaxError in Twig 4.0 (first definition at line %d, second at line %d). The last definition is used in Twig 3.', $name, $this->stream->getSourceContext()->getName(), $this->macros[$name]->getTemplateLine(), $node->getTemplateLine());
}

$this->macros[$name] = $node;
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/macros/duplicate_definition.legacy.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--TEST--
Defining a macro more than once is deprecated
--DEPRECATION--
Since twig/twig 3.29: Defining the macro "greet" more than once in "index.twig" is deprecated and will throw a SyntaxError in Twig 4.0 (first definition at line 3, second at line 4).
Since twig/twig 3.29: Defining the macro "greet" more than once in "index.twig" is deprecated and will throw a SyntaxError in Twig 4.0 (first definition at line 3, second at line 4). The last definition is used in Twig 3.
--TEMPLATE--
{% import _self as macros %}
{% macro greet() %}first{% endmacro %}
Expand Down
Loading