Skip to content

Commit

Permalink
feature #2202 deprecated Twig_Parser::addHandler() and Twig_Parser::a…
Browse files Browse the repository at this point in the history
…ddNodeVisitor() (fabpot)

This PR was merged into the 1.x branch.

Discussion
----------

deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor()

I don't even understand why these methods are here. It looks like they never had any usage in the core.

Commits
-------

31c444b deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor()
  • Loading branch information
fabpot committed Oct 24, 2016
2 parents cefaecf + 31c444b commit 9cab8b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,5 +1,6 @@
* 1.27.0 (2016-XX-XX)

* deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor()
* deprecated Twig_Compiler::addIndentation()
* fixed regression when registering two extensions having the same class name
* deprecated Twig_LoaderInterface::getSource() (implement Twig_SourceContextLoaderInterface instead)
Expand Down
3 changes: 3 additions & 0 deletions doc/deprecated.rst
Expand Up @@ -203,3 +203,6 @@ Miscellaneous

* As of Twig 1.27, ``Twig_Template::getSource()`` is deprecated. Use
``Twig_Template::getSourceContext()`` instead.

* As of Twig 1.27, ``Twig_Parser::addHandler()`` and
``Twig_Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0.
10 changes: 10 additions & 0 deletions lib/Twig/Parser.php
Expand Up @@ -208,13 +208,23 @@ public function subparse($test, $dropNeedle = false)
return new Twig_Node($rv, array(), $lineno);
}

/**
* @deprecated since 1.27 (to be removed in 2.0)
*/
public function addHandler($name, $class)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);

$this->handlers[$name] = $class;
}

/**
* @deprecated since 1.27 (to be removed in 2.0)
*/
public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);

$this->visitors[] = $visitor;
}

Expand Down

0 comments on commit 9cab8b9

Please sign in to comment.