diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index 9676452219e..4aded7c5aeb 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -77,17 +77,20 @@ register. class StringExpressionLanguageProvider implements ExpressionFunctionProviderInterface { - return array( - new ExpressionFunction('lowercase', function ($str) { - return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str); - }, function ($arguments, $str) { - if (!is_string($str)) { - return $str; - } - - return strtolower($str); - }); - ); + public function getFunctions() + { + return array( + new ExpressionFunction('lowercase', function ($str) { + return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str); + }, function ($arguments, $str) { + if (!is_string($str)) { + return $str; + } + + return strtolower($str); + }), + ); + } } You can register providers using