added a deprecation notice when using the spaceless tag

This commit is contained in:
Fabien Potencier
2019-03-10 09:05:07 +01:00
parent a65a807afa
commit 432f295baa
4 changed files with 7 additions and 0 deletions
+2
View File
@@ -30,6 +30,8 @@ final class SpacelessTokenParser extends AbstractTokenParser
{
public function parse(Token $token)
{
@trigger_error('The spaceless tag is deprecated since version 2.7, use the spaceless filter instead.', E_USER_DEPRECATED);
$lineno = $token->getLine();
$this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3);
@@ -1,5 +1,7 @@
--TEST--
capturing "block" tag
--DEPRECATION--
The spaceless tag is deprecated since version 2.7, use the spaceless filter instead.
--TEMPLATE--
{% set foo %}{% block foo %}FOO{% endblock %}{% endset %}
{{ foo }}
@@ -1,6 +1,7 @@
--TEST--
"spaceless" tag in the root level of a child template
--DEPRECATION--
The spaceless tag is deprecated since version 2.7, use the spaceless filter instead.
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.
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.
--TEMPLATE--
@@ -1,5 +1,7 @@
--TEST--
"spaceless" tag removes whites between HTML tags
--DEPRECATION--
The spaceless tag is deprecated since version 2.7, use the spaceless filter instead.
--TEMPLATE--
{% spaceless %}