Skip to content

Commit a2ea256

Browse files
committed
bug #4637 fixed StringExpressionLanguageProvider code example #4636 (danieleorler)
This PR was squashed before being merged into the 2.6 branch (closes #4637). Discussion ---------- fixed StringExpressionLanguageProvider code example #4636 | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.6 | Fixed tickets | #4636 Commits ------- 33e0a7f fixed StringExpressionLanguageProvider code example #4636
2 parents fc3e50b + 33e0a7f commit a2ea256

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

components/expression_language/extending.rst

+14-11
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,20 @@ register.
7777
7878
class StringExpressionLanguageProvider implements ExpressionFunctionProviderInterface
7979
{
80-
return array(
81-
new ExpressionFunction('lowercase', function ($str) {
82-
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
83-
}, function ($arguments, $str) {
84-
if (!is_string($str)) {
85-
return $str;
86-
}
87-
88-
return strtolower($str);
89-
});
90-
);
80+
public function getFunctions()
81+
{
82+
return array(
83+
new ExpressionFunction('lowercase', function ($str) {
84+
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
85+
}, function ($arguments, $str) {
86+
if (!is_string($str)) {
87+
return $str;
88+
}
89+
90+
return strtolower($str);
91+
}),
92+
);
93+
}
9194
}
9295
9396
You can register providers using

0 commit comments

Comments
 (0)