diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php index 18f7296d3e56f..2bc17b4403ddf 100644 --- a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php +++ b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php @@ -42,20 +42,29 @@ class ExpressionFunction public function __construct(string $name, callable $compiler, callable $evaluator) { $this->name = $name; - $this->compiler = $compiler; - $this->evaluator = $evaluator; + $this->compiler = $compiler instanceof \Closure ? $compiler : \Closure::fromCallable($compiler); + $this->evaluator = $evaluator instanceof \Closure ? $evaluator : \Closure::fromCallable($evaluator); } + /** + * @return string + */ public function getName() { return $this->name; } + /** + * @return \Closure + */ public function getCompiler() { return $this->compiler; } + /** + * @return \Closure + */ public function getEvaluator() { return $this->evaluator;