From 600d48162a3f4c3fd903d8b065c9e0cbe1a6e5de Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 10 Feb 2014 07:34:14 +0100 Subject: [PATCH] [ExpressionLanguage] added some documentation about functions --- .../ExpressionLanguage/ExpressionLanguage.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php index 57dae3a9ca47..e079fba6491b 100644 --- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php +++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php @@ -92,6 +92,18 @@ public function parse($expression, $names) /** * Registers a function. * + * A function is defined by two PHP callables. The callables are used + * by the language to compile and/or evaluate the function. + * + * The first function is used at compilation time and must return a + * PHP representation of the function call (it receives the function + * arguments as arguments). + * + * The second function is used for expression evaluation and must return + * the value of the function call based on the values defined for the + * expression (it receives the values as a first argument and the function + * arguments as remaining arguments). + * * @param string $name The function name * @param callable $compiler A callable able to compile the function * @param callable $evaluator A callable able to evaluate the function