Browse code

feature #2202 deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor() (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()

Fabien Potencier authored on 24/10/2016 15:26:26
Showing 3 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 * 1.27.0 (2016-XX-XX)
2 2
 
3
+ * deprecated Twig_Parser::addHandler() and Twig_Parser::addNodeVisitor()
3 4
  * deprecated Twig_Compiler::addIndentation()
4 5
  * fixed regression when registering two extensions having the same class name
5 6
  * deprecated Twig_LoaderInterface::getSource() (implement Twig_SourceContextLoaderInterface instead)
... ...
@@ -203,3 +203,6 @@ Miscellaneous
203 203
 
204 204
 * As of Twig 1.27, ``Twig_Template::getSource()`` is deprecated. Use
205 205
   ``Twig_Template::getSourceContext()`` instead.
206
+
207
+* As of Twig 1.27, ``Twig_Parser::addHandler()`` and
208
+  ``Twig_Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0.
... ...
@@ -208,13 +208,23 @@ class Twig_Parser implements Twig_ParserInterface
208 208
         return new Twig_Node($rv, array(), $lineno);
209 209
     }
210 210
 
211
+    /**
212
+     * @deprecated since 1.27 (to be removed in 2.0)
213
+     */
211 214
     public function addHandler($name, $class)
212 215
     {
216
+        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
217
+
213 218
         $this->handlers[$name] = $class;
214 219
     }
215 220
 
221
+    /**
222
+     * @deprecated since 1.27 (to be removed in 2.0)
223
+     */
216 224
     public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
217 225
     {
226
+        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
227
+
218 228
         $this->visitors[] = $visitor;
219 229
     }
220 230