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 * 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 (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. global effect on the template and must be declared at the root of its body.
Filters Filters
+1 -1
View File
@@ -159,7 +159,7 @@ final class CorrectnessNodeVisitor implements NodeVisitorInterface
} }
if (!isset($this->rootNodes[$node])) { 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-- --TEST--
"extends" tag in a condition "extends" tag in a condition
--DEPRECATION-- --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-- --TEMPLATE--
{% if false %} {% if false %}
{% extends "base.twig" %} {% extends "base.twig" %}
@@ -1,7 +1,7 @@
--TEST-- --TEST--
"use" tag in a condition "use" tag in a condition
--DEPRECATION-- --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-- --TEMPLATE--
{% if false %} {% if false %}
{% use "base.twig" %} {% use "base.twig" %}
@@ -1,7 +1,7 @@
--TEST-- --TEST--
"use" tag in a macro "use" tag in a macro
--DEPRECATION-- --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-- --TEMPLATE--
{% macro input(name, value, type, size) %} {% macro input(name, value, type, size) %}
{% use "base.twig" %} {% use "base.twig" %}
@@ -1,7 +1,7 @@
--TEST-- --TEST--
"macro" tag in a block "macro" tag in a block
--DEPRECATION-- --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-- --TEMPLATE--
{% block foo %} {% block foo %}
{% macro input(name, value, type, size) %} {% macro input(name, value, type, size) %}
@@ -1,7 +1,7 @@
--TEST-- --TEST--
"macro" tag in a condition "macro" tag in a condition
--DEPRECATION-- --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-- --TEMPLATE--
{% if false %} {% if false %}
{% macro input(name, value, type, size) %} {% macro input(name, value, type, size) %}