File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
components/expression_language Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ This method has 3 arguments:
34
34
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
35
35
36
36
$expressionLanguage = new ExpressionLanguage();
37
- $expressionLanguage->register('lowercase', function ($arguments, $ str) {
37
+ $expressionLanguage->register('lowercase', function ($str) {
38
38
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
39
39
}, function ($arguments, $str) {
40
40
if (!is_string($str)) {
@@ -45,11 +45,11 @@ This method has 3 arguments:
45
45
});
46
46
47
47
var_dump($expressionLanguage->evaluate('lowercase("HELLO")'));
48
+ // this will print: hello
48
49
49
- This will print ``hello ``. Both the **compiler ** and **evaluator ** are passed
50
- an ``arguments `` variable as their first argument, which is equal to the
51
- second argument to ``evaluate() `` or ``compile() `` (e.g. the "values" when
52
- evaluating or the "names" if compiling).
50
+ In addition to the custom function arguments, the **evaluator ** is passed an
51
+ ``arguments `` variable as its first argument, which is equal to the second
52
+ argument of ``compile() `` (e.g. the "values" when evaluating an expression).
53
53
54
54
.. _components-expression-language-provider :
55
55
You can’t perform that action at this time.
0 commit comments