fix version in deprecation message for tag usage outside of root template

This commit is contained in:
Matthieu Lempereur
2026-07-08 19:01:20 +02:00
committed by GitHub
parent d1abdf483a
commit fc4dee393c
7 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -303,7 +303,7 @@ Templates
* Using a ``macro``, ``extends``, or ``use`` tag outside the root of a template
(for instance nested under an ``if`` or inside a ``block`` or ``macro``) is
deprecated as of Twig 3.27 and will throw in Twig 4.0. These tags have a
deprecated as of Twig 3.28 and will throw in Twig 4.0. These tags have a
global effect on the template and must be declared at the root of its body.
Filters
+1 -1
View File
@@ -159,7 +159,7 @@ final class CorrectnessNodeVisitor implements NodeVisitorInterface
}
if (!isset($this->rootNodes[$node])) {
trigger_deprecation('twig/twig', '3.27', 'Using the "%s" tag outside the root of a template is deprecated in %s at line %d.', $node->getNodeTag(), $node->getSourceContext()->getName(), $node->getTemplateLine());
trigger_deprecation('twig/twig', '3.28', 'Using the "%s" tag outside the root of a template is deprecated in %s at line %d.', $node->getNodeTag(), $node->getSourceContext()->getName(), $node->getTemplateLine());
}
}
@@ -1,7 +1,7 @@
--TEST--
"extends" tag in a condition
--DEPRECATION--
Since twig/twig 3.27: Using the "extends" tag outside the root of a template is deprecated in index.twig at line 3.
Since twig/twig 3.28: Using the "extends" tag outside the root of a template is deprecated in index.twig at line 3.
--TEMPLATE--
{% if false %}
{% extends "base.twig" %}
@@ -1,7 +1,7 @@
--TEST--
"use" tag in a condition
--DEPRECATION--
Since twig/twig 3.27: Using the "use" tag outside the root of a template is deprecated in index.twig at line 3.
Since twig/twig 3.28: Using the "use" tag outside the root of a template is deprecated in index.twig at line 3.
--TEMPLATE--
{% if false %}
{% use "base.twig" %}
@@ -1,7 +1,7 @@
--TEST--
"use" tag in a macro
--DEPRECATION--
Since twig/twig 3.27: Using the "use" tag outside the root of a template is deprecated in index.twig at line 3.
Since twig/twig 3.28: Using the "use" tag outside the root of a template is deprecated in index.twig at line 3.
--TEMPLATE--
{% macro input(name, value, type, size) %}
{% use "base.twig" %}
@@ -1,7 +1,7 @@
--TEST--
"macro" tag in a block
--DEPRECATION--
Since twig/twig 3.27: Using the "macro" tag outside the root of a template is deprecated in index.twig at line 3.
Since twig/twig 3.28: Using the "macro" tag outside the root of a template is deprecated in index.twig at line 3.
--TEMPLATE--
{% block foo %}
{% macro input(name, value, type, size) %}
@@ -1,7 +1,7 @@
--TEST--
"macro" tag in a condition
--DEPRECATION--
Since twig/twig 3.27: Using the "macro" tag outside the root of a template is deprecated in index.twig at line 3.
Since twig/twig 3.28: Using the "macro" tag outside the root of a template is deprecated in index.twig at line 3.
--TEMPLATE--
{% if false %}
{% macro input(name, value, type, size) %}