Explorar o código

[Config] added the possibility to use a Closure for default values

Fabien Potencier %!s(int64=14) %!d(string=hai) anos
pai
achega
e0df94cb8b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/Symfony/Component/Config/Definition/VariableNode.php

+ 1 - 1
src/Symfony/Component/Config/Definition/VariableNode.php

@@ -49,7 +49,7 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
      */
     public function getDefaultValue()
     {
-        return $this->defaultValue;
+        return $this->defaultValue instanceof \Closure ? call_user_func($this->defaultValue) : $this->defaultValue;
     }
 
     /**