mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-10 09:26:29 +00:00
deprecated the filter tag
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 2.9.0 (2019-XX-XX)
|
||||
|
||||
* deprecated the "filter" tag (use the "apply" tag instead)
|
||||
* added template line number to twig_get_attribute()
|
||||
|
||||
* 2.8.1 (2019-04-16)
|
||||
|
||||
+4
-1
@@ -29,13 +29,16 @@ Tags
|
||||
----
|
||||
|
||||
* The ``spaceless`` tag is deprecated in Twig 2.7. Use the ``spaceless`` filter
|
||||
instead or ``{% filter spaceless %}`` (the ``Twig\Node\SpacelessNode`` and
|
||||
instead or ``{% apply spaceless %}`` (the ``Twig\Node\SpacelessNode`` and
|
||||
``Twig\TokenParser\SpacelessTokenParser`` classes are also deprecated).
|
||||
|
||||
* Using the ``spaceless`` tag at the root level of a child template is
|
||||
deprecated in Twig 2.5.0. This does not work as one would expect it to work
|
||||
anyway. In Twig 3.0, it will throw a ``Twig\Error\SyntaxError`` exception.
|
||||
|
||||
* The ``filter`` tag is deprecated in Twig 2.9. Use the ``apply`` tag instead
|
||||
(the ``Twig\TokenParser\FilterTokenParser`` classes is also deprecated).
|
||||
|
||||
Final Classes
|
||||
-------------
|
||||
|
||||
|
||||
@@ -23,11 +23,15 @@ use Twig\Token;
|
||||
* {% filter upper %}
|
||||
* This text becomes uppercase
|
||||
* {% endfilter %}
|
||||
*
|
||||
* @deprecated since Twig 2.9, to be removed in 3.0 (use the "apply" tag instead)
|
||||
*/
|
||||
final class FilterTokenParser extends AbstractTokenParser
|
||||
{
|
||||
public function parse(Token $token)
|
||||
{
|
||||
@trigger_error('The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.', E_USER_DEPRECATED);
|
||||
|
||||
$name = $this->parser->getVarName();
|
||||
$ref = new BlockReferenceExpression(new ConstantExpression($name, $token->getLine()), null, $token->getLine(), $this->getTag());
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ macro with a filter
|
||||
{% import _self as test %}
|
||||
|
||||
{% macro test() %}
|
||||
{% filter escape %}foo<br />{% endfilter %}
|
||||
{% apply escape %}foo<br />{% endapply %}
|
||||
{% endmacro %}
|
||||
|
||||
{{ test.test() }}
|
||||
|
||||
@@ -3,14 +3,14 @@ Block names are unique per template
|
||||
--TEMPLATE--
|
||||
{% extends 'layout' %}
|
||||
{% block content -%}
|
||||
{% filter title -%}
|
||||
{% apply title -%}
|
||||
second
|
||||
{% endfilter %}
|
||||
{% endapply %}
|
||||
{% endblock %}
|
||||
--TEMPLATE(layout)--
|
||||
{% filter title -%}
|
||||
{% apply title -%}
|
||||
first
|
||||
{% endfilter %}
|
||||
{% endapply %}
|
||||
{% block content %}{% endblock %}
|
||||
--DATA--
|
||||
return []
|
||||
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"filter" tag applies a filter on its children
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter upper %}
|
||||
Some text with a {{ var }}
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"filter" tag applies a filter on its children
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter json_encode|raw %}test{% endfilter %}
|
||||
--DATA--
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"filter" tags accept multiple chained filters
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter lower|title %}
|
||||
{{ var }}
|
||||
+3
@@ -1,5 +1,8 @@
|
||||
--TEST--
|
||||
"filter" tags can be nested at will
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter lower|title %}
|
||||
{{ var }}
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"scope" tag creates a new scope
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter spaceless %}
|
||||
{% set item = 'foo' %}
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"filter" tag applies the filter on "for" tags
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter upper %}
|
||||
{% for item in items %}
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
--TEST--
|
||||
"filter" tag applies the filter on "if" tags
|
||||
--DEPRECATION--
|
||||
The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.
|
||||
--TEMPLATE--
|
||||
{% filter upper %}
|
||||
{% if items %}
|
||||
Reference in New Issue
Block a user