Browse code

fixed class names

Fabien Potencier authored on 05/01/2017 19:38:57
Showing 7 changed files
... ...
@@ -230,7 +230,7 @@ When a filter should accept an arbitrary number of arguments, set the
230 230
 ``is_variadic`` option to ``true``; Twig will pass the extra arguments as the
231 231
 last argument to the filter call as an array::
232 232
 
233
-    $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) {
233
+    $filter = new Twig_Filter('thumbnail', function ($file, array $options = array()) {
234 234
         // ...
235 235
     }, array('is_variadic' => true));
236 236
 
... ...
@@ -270,7 +270,7 @@ You can mark a filter as being deprecated by setting the ``deprecated`` option
270 270
 to ``true``. You can also give an alternative filter that replaces the
271 271
 deprecated one when that makes sense::
272 272
 
273
-    $filter = new Twig_SimpleFilter('obsolete', function () {
273
+    $filter = new Twig_Filter('obsolete', function () {
274 274
         // ...
275 275
     }, array('deprecated' => true, 'alternative' => 'new_one'));
276 276
 
... ...
@@ -553,21 +553,21 @@ An extension is a class that implements the following interface::
553 553
         /**
554 554
          * Returns a list of filters to add to the existing list.
555 555
          *
556
-         * @return Twig_SimpleFilter[]
556
+         * @return Twig_Filter[]
557 557
          */
558 558
         public function getFilters();
559 559
 
560 560
         /**
561 561
          * Returns a list of tests to add to the existing list.
562 562
          *
563
-         * @return Twig_SimpleTest[]
563
+         * @return Twig_Test[]
564 564
          */
565 565
         public function getTests();
566 566
 
567 567
         /**
568 568
          * Returns a list of functions to add to the existing list.
569 569
          *
570
-         * @return Twig_SimpleFunction[]
570
+         * @return Twig_Function[]
571 571
          */
572 572
         public function getFunctions();
573 573
 
... ...
@@ -749,7 +749,7 @@ The simplest way to use methods is to define them on the extension itself::
749 749
         public function getFunctions()
750 750
         {
751 751
             return array(
752
-                new Twig_SimpleFunction('rot13', array($this, 'rot13')),
752
+                new Twig_Function('rot13', array($this, 'rot13')),
753 753
             );
754 754
         }
755 755
 
... ...
@@ -808,9 +808,9 @@ It is now possible to move the runtime logic to a new
808 808
         public function getFunctions()
809 809
         {
810 810
             return array(
811
-                new Twig_SimpleFunction('rot13', array('Project_Twig_RuntimeExtension', 'rot13')),
811
+                new Twig_Function('rot13', array('Project_Twig_RuntimeExtension', 'rot13')),
812 812
                 // or
813
-                new Twig_SimpleFunction('rot13', 'Project_Twig_RuntimeExtension::rot13'),
813
+                new Twig_Function('rot13', 'Project_Twig_RuntimeExtension::rot13'),
814 814
             );
815 815
         }
816 816
     }
... ...
@@ -277,7 +277,7 @@ For functions, use ``registerUndefinedFunctionCallback()``::
277 277
     // don't try this at home as it's not secure at all!
278 278
     $twig->registerUndefinedFunctionCallback(function ($name) {
279 279
         if (function_exists($name)) {
280
-            return new Twig_SimpleFunction($name, $name);
280
+            return new Twig_Function($name, $name);
281 281
         }
282 282
 
283 283
         return false;
... ...
@@ -33,21 +33,21 @@ interface Twig_ExtensionInterface
33 33
     /**
34 34
      * Returns a list of filters to add to the existing list.
35 35
      *
36
-     * @return Twig_SimpleFilter[]
36
+     * @return Twig_Filter[]
37 37
      */
38 38
     public function getFilters();
39 39
 
40 40
     /**
41 41
      * Returns a list of tests to add to the existing list.
42 42
      *
43
-     * @return Twig_SimpleTest[]
43
+     * @return Twig_Test[]
44 44
      */
45 45
     public function getTests();
46 46
 
47 47
     /**
48 48
      * Returns a list of functions to add to the existing list.
49 49
      *
50
-     * @return Twig_SimpleFunction[]
50
+     * @return Twig_Function[]
51 51
      */
52 52
     public function getFunctions();
53 53
 
... ...
@@ -31,7 +31,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
31 31
     }
32 32
 
33 33
     /**
34
-     * @return Twig_SimpleFilter[]
34
+     * @return Twig_Filter[]
35 35
      */
36 36
     protected function getTwigFilters()
37 37
     {
... ...
@@ -39,7 +39,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
39 39
     }
40 40
 
41 41
     /**
42
-     * @return Twig_SimpleFunction[]
42
+     * @return Twig_Function[]
43 43
      */
44 44
     protected function getTwigFunctions()
45 45
     {
... ...
@@ -47,7 +47,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
47 47
     }
48 48
 
49 49
     /**
50
-     * @return Twig_SimpleTest[]
50
+     * @return Twig_Test[]
51 51
      */
52 52
     protected function getTwigTests()
53 53
     {
... ...
@@ -462,8 +462,8 @@ class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends Twig_Extension
462 462
     public function getFunctions()
463 463
     {
464 464
         return array(
465
-            new Twig_SimpleFunction('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')),
466
-            new Twig_SimpleFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'),
465
+            new Twig_Function('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')),
466
+            new Twig_Function('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'),
467 467
         );
468 468
     }
469 469
 
... ...
@@ -26,8 +26,8 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase
26 26
     public function getTests()
27 27
     {
28 28
         $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
29
-        $environment->addFilter(new Twig_SimpleFilter('bar', 'twig_tests_filter_dummy', array('needs_environment' => true)));
30
-        $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true)));
29
+        $environment->addFilter(new Twig_Filter('bar', 'twig_tests_filter_dummy', array('needs_environment' => true)));
30
+        $environment->addFilter(new Twig_Filter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true)));
31 31
 
32 32
         $tests = array();
33 33
 
... ...
@@ -26,7 +26,7 @@ class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase
26 26
     public function getTests()
27 27
     {
28 28
         $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
29
-        $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true)));
29
+        $environment->addTest(new Twig_Test('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true)));
30 30
 
31 31
         $tests = array();
32 32