mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 02:16:41 +00:00
fixed class names
This commit is contained in:
+8
-8
@@ -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'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user