... | ... |
@@ -30,21 +30,24 @@ final class FilterTokenParser extends AbstractTokenParser |
30 | 30 |
{ |
31 | 31 |
public function parse(Token $token) |
32 | 32 |
{ |
33 |
- @trigger_error('The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead.', E_USER_DEPRECATED); |
|
33 |
+ $stream = $this->parser->getStream(); |
|
34 |
+ $lineno = $token->getLine(); |
|
35 |
+ |
|
36 |
+ @trigger_error(sprintf('The "filter" tag in "%s" at line %d is deprecated since Twig 2.9, use the "apply" tag instead.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); |
|
34 | 37 |
|
35 | 38 |
$name = $this->parser->getVarName(); |
36 |
- $ref = new BlockReferenceExpression(new ConstantExpression($name, $token->getLine()), null, $token->getLine(), $this->getTag()); |
|
39 |
+ $ref = new BlockReferenceExpression(new ConstantExpression($name, $lineno), null, $lineno, $this->getTag()); |
|
37 | 40 |
|
38 | 41 |
$filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); |
39 |
- $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
42 |
+ $stream->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
40 | 43 |
|
41 | 44 |
$body = $this->parser->subparse([$this, 'decideBlockEnd'], true); |
42 |
- $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
45 |
+ $stream->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
43 | 46 |
|
44 |
- $block = new BlockNode($name, $body, $token->getLine()); |
|
47 |
+ $block = new BlockNode($name, $body, $lineno); |
|
45 | 48 |
$this->parser->setBlock($name, $block); |
46 | 49 |
|
47 |
- return new PrintNode($filter, $token->getLine(), $this->getTag()); |
|
50 |
+ return new PrintNode($filter, $lineno, $this->getTag()); |
|
48 | 51 |
} |
49 | 52 |
|
50 | 53 |
public function decideBlockEnd(Token $token) |
... | ... |
@@ -43,7 +43,7 @@ final class ForTokenParser extends AbstractTokenParser |
43 | 43 |
|
44 | 44 |
$ifexpr = null; |
45 | 45 |
if ($stream->nextIf(/* Token::NAME_TYPE */ 5, 'if')) { |
46 |
- @trigger_error(sprintf('Using an "if" condition on "for" tag is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop).', __CLASS__), E_USER_DEPRECATED); |
|
46 |
+ @trigger_error(sprintf('Using an "if" condition on "for" tag in "%s" at line %d is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop).', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); |
|
47 | 47 |
|
48 | 48 |
$ifexpr = $this->parser->getExpressionParser()->parseExpression(); |
49 | 49 |
} |
... | ... |
@@ -30,13 +30,14 @@ final class SpacelessTokenParser extends AbstractTokenParser |
30 | 30 |
{ |
31 | 31 |
public function parse(Token $token) |
32 | 32 |
{ |
33 |
- @trigger_error('The spaceless tag is deprecated since Twig 2.7, use the spaceless filter instead.', E_USER_DEPRECATED); |
|
34 |
- |
|
33 |
+ $stream = $this->parser->getStream(); |
|
35 | 34 |
$lineno = $token->getLine(); |
36 | 35 |
|
37 |
- $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
36 |
+ @trigger_error(sprintf('The spaceless tag in "%s" at line %d is deprecated since Twig 2.7, use the spaceless filter instead.', $stream->getSourceContext()->getName(), $lineno), E_USER_DEPRECATED); |
|
37 |
+ |
|
38 |
+ $stream->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
38 | 39 |
$body = $this->parser->subparse([$this, 'decideSpacelessEnd'], true); |
39 |
- $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
40 |
+ $stream->expect(/* Token::BLOCK_END_TYPE */ 3); |
|
40 | 41 |
|
41 | 42 |
return new SpacelessNode($body, $lineno, $this->getTag()); |
42 | 43 |
} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
capturing "block" tag |
3 | 3 |
--DEPRECATION-- |
4 |
-The spaceless tag is deprecated since Twig 2.7, use the spaceless filter instead. |
|
4 |
+The spaceless tag in "index.twig" at line 4 is deprecated since Twig 2.7, use the spaceless filter instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% set foo %}{% block foo %}FOO{% endblock %}{% endset %} |
7 | 7 |
{{ foo }} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tag applies a filter on its children |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter upper %} |
7 | 7 |
Some text with a {{ var }} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tag applies a filter on its children |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter json_encode|raw %}test{% endfilter %} |
7 | 7 |
--DATA-- |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tags accept multiple chained filters |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter lower|title %} |
7 | 7 |
{{ var }} |
... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tags can be nested at will |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 |
+The "filter" tag in "index.twig" at line 4 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
6 | 6 |
--TEMPLATE-- |
7 | 7 |
{% filter lower|title %} |
8 | 8 |
{{ var }} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"scope" tag creates a new scope |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter spaceless %} |
7 | 7 |
{% set item = 'foo' %} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tag applies the filter on "for" tags |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter upper %} |
7 | 7 |
{% for item in items %} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"filter" tag applies the filter on "if" tags |
3 | 3 |
--DEPRECATION-- |
4 |
-The "filter" tag is deprecated since Twig 2.9, use the "apply" tag instead. |
|
4 |
+The "filter" tag in "index.twig" at line 2 is deprecated since Twig 2.9, use the "apply" tag instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% filter upper %} |
7 | 7 |
{% if items %} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"for" tag takes a condition |
3 | 3 |
--DEPRECATION-- |
4 |
-Using an "if" condition on "for" tag is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop). |
|
4 |
+Using an "if" condition on "for" tag in "index.twig" at line 2 is deprecated since Twig 2.10.0, use a "filter" filter or an "if" condition inside the "for" body instead (if your condition depends on a variable updated inside the loop). |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% for i in 1..5 if i is odd -%} |
7 | 7 |
{{ loop.index }}.{{ i }}{{ foo.bar }} |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"spaceless" tag in the root level of a child template |
3 | 3 |
--DEPRECATION-- |
4 |
-The spaceless tag is deprecated since Twig 2.7, use the spaceless filter instead. |
|
4 |
+The spaceless tag in "index.twig" at line 3 is deprecated since Twig 2.7, use the spaceless filter instead. |
|
5 | 5 |
Using the spaceless tag at the root level of a child template in "index.twig" at line 3 is deprecated since Twig 2.5.0 and will become a syntax error in 3.0. |
6 | 6 |
Nesting a block definition under a non-capturing node in "index.twig" at line 4 is deprecated since Twig 2.5.0 and will become a syntax error in 3.0. |
7 | 7 |
--TEMPLATE-- |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
--TEST-- |
2 | 2 |
"spaceless" tag removes whites between HTML tags |
3 | 3 |
--DEPRECATION-- |
4 |
-The spaceless tag is deprecated since Twig 2.7, use the spaceless filter instead. |
|
4 |
+The spaceless tag in "index.twig" at line 2 is deprecated since Twig 2.7, use the spaceless filter instead. |
|
5 | 5 |
--TEMPLATE-- |
6 | 6 |
{% spaceless %} |
7 | 7 |
|