diff --git a/CHANGELOG b/CHANGELOG index 3c2da8c67..7cb2a2099 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ * 2.7.0 (2019-XX-XX) + * deprecated the spaceless tag + * added a spaceless filter * added max value to the "random" function * deprecated Twig\Extension\InitRuntimeInterface * deprecated Twig\Loader\ExistsLoaderInterface diff --git a/doc/deprecated.rst b/doc/deprecated.rst index fa3fccaef..ac0a338ef 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -28,6 +28,10 @@ Errors Tags ---- +* The ``spaceless`` tag is deprecated in Twig 2.7. Use the ``spaceless`` filter + instead or ``{% filter 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. diff --git a/src/Node/SpacelessNode.php b/src/Node/SpacelessNode.php index 0572e7e9f..99deb350e 100644 --- a/src/Node/SpacelessNode.php +++ b/src/Node/SpacelessNode.php @@ -18,6 +18,8 @@ use Twig\Compiler; * * It removes spaces between HTML tags. * + * @deprecated since Twig 2.7, to be removed in 3.0 + * * @author Fabien Potencier */ class SpacelessNode extends Node implements NodeOutputInterface diff --git a/src/TokenParser/SpacelessTokenParser.php b/src/TokenParser/SpacelessTokenParser.php index f8e26999e..23911d08a 100644 --- a/src/TokenParser/SpacelessTokenParser.php +++ b/src/TokenParser/SpacelessTokenParser.php @@ -23,6 +23,8 @@ use Twig\Token; * * {% endspaceless %} * {# output will be
foo
#} + * + * @deprecated since Twig 2.7, to be removed in 3.0 (use the spaceless filter instead) */ final class SpacelessTokenParser extends AbstractTokenParser {