minor #10222 [ExpressionLanguage] added some documentation about functions (fabpot)

This PR was merged into the 2.4 branch.

Discussion
----------

[ExpressionLanguage] added some documentation about functions

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10216
| License       | MIT
| Doc PR        | n/a

This adds documentation about how to define a function in the expression language.

Commits
-------

600d481 [ExpressionLanguage] added some documentation about functions
This commit is contained in:
Fabien Potencier 2014-02-10 15:27:45 +01:00
commit 4ab78e0561

View File

@ -92,6 +92,18 @@ class ExpressionLanguage
/**
* 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