Browse code

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

Fabien Potencier authored on 23/10/2016 20:50:47
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
  * fixed regression when registering two extensions having the same class name
4 5
  * deprecated Twig_LoaderInterface::getSource() (implement Twig_SourceContextLoaderInterface instead)
5 6
  * fixed the filesystem loader with relative paths
... ...
@@ -200,3 +200,6 @@ Miscellaneous
200 200
 
201 201
 * As of Twig 1.27, ``Twig_Template::getSource()`` is deprecated. Use
202 202
   ``Twig_Template::getSourceContext()`` instead.
203
+
204
+* As of Twig 1.27, ``Twig_Parser::addHandler()`` and
205
+  ``Twig_Parser::addNodeVisitor()`` are deprecated and will be removed in 2.0.
... ...
@@ -207,13 +207,23 @@ class Twig_Parser implements Twig_ParserInterface
207 207
         return new Twig_Node($rv, array(), $lineno);
208 208
     }
209 209
 
210
+    /**
211
+     * @deprecated since 1.27 (to be removed in 2.0)
212
+     */
210 213
     public function addHandler($name, $class)
211 214
     {
215
+        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
216
+
212 217
         $this->handlers[$name] = $class;
213 218
     }
214 219
 
220
+    /**
221
+     * @deprecated since 1.27 (to be removed in 2.0)
222
+     */
215 223
     public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
216 224
     {
225
+        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0.', E_USER_DEPRECATED);
226
+
217 227
         $this->visitors[] = $visitor;
218 228
     }
219 229