diff --git a/doc/advanced.rst b/doc/advanced.rst index fe5d5625a..3dd2e5dd5 100644 --- a/doc/advanced.rst +++ b/doc/advanced.rst @@ -230,7 +230,7 @@ When a filter should accept an arbitrary number of arguments, set the ``is_variadic`` option to ``true``; Twig will pass the extra arguments as the last argument to the filter call as an array:: - $filter = new Twig_SimpleFilter('thumbnail', function ($file, array $options = array()) { + $filter = new Twig_Filter('thumbnail', function ($file, array $options = array()) { // ... }, array('is_variadic' => true)); @@ -270,7 +270,7 @@ You can mark a filter as being deprecated by setting the ``deprecated`` option to ``true``. You can also give an alternative filter that replaces the deprecated one when that makes sense:: - $filter = new Twig_SimpleFilter('obsolete', function () { + $filter = new Twig_Filter('obsolete', function () { // ... }, array('deprecated' => true, 'alternative' => 'new_one')); @@ -553,21 +553,21 @@ An extension is a class that implements the following interface:: /** * Returns a list of filters to add to the existing list. * - * @return Twig_SimpleFilter[] + * @return Twig_Filter[] */ public function getFilters(); /** * Returns a list of tests to add to the existing list. * - * @return Twig_SimpleTest[] + * @return Twig_Test[] */ public function getTests(); /** * Returns a list of functions to add to the existing list. * - * @return Twig_SimpleFunction[] + * @return Twig_Function[] */ public function getFunctions(); @@ -749,7 +749,7 @@ The simplest way to use methods is to define them on the extension itself:: public function getFunctions() { return array( - new Twig_SimpleFunction('rot13', array($this, 'rot13')), + new Twig_Function('rot13', array($this, 'rot13')), ); } @@ -808,9 +808,9 @@ It is now possible to move the runtime logic to a new public function getFunctions() { return array( - new Twig_SimpleFunction('rot13', array('Project_Twig_RuntimeExtension', 'rot13')), + new Twig_Function('rot13', array('Project_Twig_RuntimeExtension', 'rot13')), // or - new Twig_SimpleFunction('rot13', 'Project_Twig_RuntimeExtension::rot13'), + new Twig_Function('rot13', 'Project_Twig_RuntimeExtension::rot13'), ); } } diff --git a/doc/recipes.rst b/doc/recipes.rst index 40c0efa26..f03cd2607 100644 --- a/doc/recipes.rst +++ b/doc/recipes.rst @@ -277,7 +277,7 @@ For functions, use ``registerUndefinedFunctionCallback()``:: // don't try this at home as it's not secure at all! $twig->registerUndefinedFunctionCallback(function ($name) { if (function_exists($name)) { - return new Twig_SimpleFunction($name, $name); + return new Twig_Function($name, $name); } return false; diff --git a/lib/Twig/ExtensionInterface.php b/lib/Twig/ExtensionInterface.php index a3829509b..6db4171ef 100644 --- a/lib/Twig/ExtensionInterface.php +++ b/lib/Twig/ExtensionInterface.php @@ -33,21 +33,21 @@ interface Twig_ExtensionInterface /** * Returns a list of filters to add to the existing list. * - * @return Twig_SimpleFilter[] + * @return Twig_Filter[] */ public function getFilters(); /** * Returns a list of tests to add to the existing list. * - * @return Twig_SimpleTest[] + * @return Twig_Test[] */ public function getTests(); /** * Returns a list of functions to add to the existing list. * - * @return Twig_SimpleFunction[] + * @return Twig_Function[] */ public function getFunctions(); diff --git a/lib/Twig/Test/IntegrationTestCase.php b/lib/Twig/Test/IntegrationTestCase.php index 65d1035b3..36a178ef2 100644 --- a/lib/Twig/Test/IntegrationTestCase.php +++ b/lib/Twig/Test/IntegrationTestCase.php @@ -31,7 +31,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase } /** - * @return Twig_SimpleFilter[] + * @return Twig_Filter[] */ protected function getTwigFilters() { @@ -39,7 +39,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase } /** - * @return Twig_SimpleFunction[] + * @return Twig_Function[] */ protected function getTwigFunctions() { @@ -47,7 +47,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase } /** - * @return Twig_SimpleTest[] + * @return Twig_Test[] */ protected function getTwigTests() { diff --git a/test/Twig/Tests/EnvironmentTest.php b/test/Twig/Tests/EnvironmentTest.php index 53cdac87d..4fce28fe6 100644 --- a/test/Twig/Tests/EnvironmentTest.php +++ b/test/Twig/Tests/EnvironmentTest.php @@ -462,8 +462,8 @@ class Twig_Tests_EnvironmentTest_ExtensionWithoutRuntime extends Twig_Extension public function getFunctions() { return array( - new Twig_SimpleFunction('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')), - new Twig_SimpleFunction('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), + new Twig_Function('from_runtime_array', array('Twig_Tests_EnvironmentTest_Runtime', 'fromRuntime')), + new Twig_Function('from_runtime_string', 'Twig_Tests_EnvironmentTest_Runtime::fromRuntime'), ); } diff --git a/test/Twig/Tests/Node/Expression/FilterTest.php b/test/Twig/Tests/Node/Expression/FilterTest.php index cb13247af..e08945644 100644 --- a/test/Twig/Tests/Node/Expression/FilterTest.php +++ b/test/Twig/Tests/Node/Expression/FilterTest.php @@ -26,8 +26,8 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase public function getTests() { $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addFilter(new Twig_SimpleFilter('bar', 'twig_tests_filter_dummy', array('needs_environment' => true))); - $environment->addFilter(new Twig_SimpleFilter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); + $environment->addFilter(new Twig_Filter('bar', 'twig_tests_filter_dummy', array('needs_environment' => true))); + $environment->addFilter(new Twig_Filter('barbar', 'twig_tests_filter_barbar', array('needs_context' => true, 'is_variadic' => true))); $tests = array(); diff --git a/test/Twig/Tests/Node/Expression/TestTest.php b/test/Twig/Tests/Node/Expression/TestTest.php index ec347ad51..7282b6897 100644 --- a/test/Twig/Tests/Node/Expression/TestTest.php +++ b/test/Twig/Tests/Node/Expression/TestTest.php @@ -26,7 +26,7 @@ class Twig_Tests_Node_Expression_TestTest extends Twig_Test_NodeTestCase public function getTests() { $environment = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()); - $environment->addTest(new Twig_SimpleTest('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); + $environment->addTest(new Twig_Test('barbar', 'twig_tests_test_barbar', array('is_variadic' => true, 'need_context' => true))); $tests = array();