mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-16 20:36:33 +00:00
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:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user