minor #2042 [DOC] recipes.rst uses Twig_Function_Function (JakeFr)

This PR was merged into the 1.x branch.

Discussion
----------

[DOC] recipes.rst uses Twig_Function_Function

Hello,
Here's a minor update for recipes.rst
I rewrite the code sample for registerUndefinedFunctionCallback to remove usage of deprecated class Twig_Function_Function.

Commits
-------

1a1ba8b [DOC] recipes.rst uses Twig_Function_Function
This commit is contained in:
Fabien Potencier
2016-05-13 14:43:49 -05:00
+1 -1
View File
@@ -280,7 +280,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_Function_Function($name);
return new Twig_SimpleFunction($name, $name);
}
return false;