Returns default value for this type

@return Node\Expr
558525
public function getDefaultValue(): Node\Expr {
        $factory = new BuilderFactory();

        if ($this->nullable || $this->mixed || $this->class) {
            return $factory->val(null);
        }

        switch ($this->name) {
        case 'array':
            return $factory->val([]);

        case 'bool':
            return $factory->val(false);

        case 'float':
            return $factory->val(0.0);

        case 'int':
            return $factory->val(0);

        case 'string':
            return $factory->val('');

        default:
            return $factory->val(null);
        }
    }
745218
private function exprStatement() {
    $node = new ExpressionStatementNode();
    $this->matchDocComment($node);
    $node->addChild($this->expr(), 'expression');
    $this->endStatement($node);
    return $node;
  }
91149
public function getDefaultValues()
    {
        $result = [];

        foreach ($this->getFormFields() as $attribute => $field) {
            if (($value = array_get($field, 'default')) === null) {
                continue;
            }

            $result[$attribute] = $value;
        }

        return $result;
    }
1060035
private function exprList() {
    $node = new CommaListNode();
    do {
      $node->addChild($this->expr());
    } while ($this->tryMatch(',', $node));
    return $node;
  }
426768
public function expr() : Expr
    {
        $expr = new Expr($this->dm);
        $expr->setClassMetadata($this->class);

        return $expr;
    }
694828
public function getValue()
    {
        $value = parent::getValue();
        return $value === null || $value === [] ? $this->getDefaultValue() : $value;
    }
952500
public function getNodeType()
    {
        $bag = hierarchy_bag('nodetype');

        if ($this->relationLoaded('nodeType'))
        {
            $nodeType = $this->getRelation('nodeType');
        } elseif ($nodeType = $bag->getNodeType($this->getNodeTypeKey()))
        {
            $this->setRelation('nodeType', $nodeType);
        } else
        {
            $nodeType = $this->load('nodeType')->getRelation('nodeType');
        }

        if ($nodeType)
        {
            $bag->addNodeType($nodeType);

            return $nodeType;
        }

        return null;
    }
455426
private function exprOperand() {
    switch ($this->currentType) {
      case T_STRING_VARNAME:
      case T_CLASS_C:
      case T_LNUMBER:
      case T_DNUMBER:
      case T_LINE:
      case T_FILE:
      case T_DIR:
      case T_TRAIT_C:
      case T_METHOD_C:
      case T_FUNC_C:
      case T_NS_C:
      case T_YIELD:
        return $this->mustMatchToken($this->currentType);
      case T_CONSTANT_ENCAPSED_STRING:
        return $this->arrayDeference($this->mustMatchToken(T_CONSTANT_ENCAPSED_STRING));
      case T_ARRAY:
        $node = new ArrayNode();
        $this->mustMatch(T_ARRAY, $node);
        $this->mustMatch('(', $node, 'openParen');
        $this->arrayPairList($node, ')');
        $this->mustMatch(')', $node, 'closeParen', TRUE);
        return $this->arrayDeference($node);
      case '[':
        $node = new ArrayNode();
        $this->mustMatch('[', $node);
        $this->arrayPairList($node, ']');
        $this->mustMatch(']', $node, NULL, TRUE);
        return $this->arrayDeference($node);
      case '(':
        $node = new ParenthesisNode();
        $this->mustMatch('(', $node, 'openParen');
        if ($this->currentType === T_NEW) {
          $node->addChild($this->newExpr(), 'expression');
          $this->mustMatch(')', $node, 'closeParen', TRUE);
          $node = $this->objectDereference($this->arrayDeference($node));
        }
        elseif ($this->currentType === T_YIELD) {
          $node->addChild($this->_yield());
          $this->mustMatch(')', $node, 'closeParen', TRUE);
        }
        else {
          $node->addChild($this->expr());
          $this->mustMatch(')', $node, 'closeParen', TRUE);
        }
        return $node;
      case T_START_HEREDOC:
        $node = new HeredocNode();
        $this->mustMatch(T_START_HEREDOC, $node);
        if ($this->tryMatch(T_END_HEREDOC, $node, NULL, TRUE)) {
          return $node;
        }
        else {
          $this->encapsList($node, T_END_HEREDOC, TRUE);
          $this->mustMatch(T_END_HEREDOC, $node, NULL, TRUE);
          return $node;
        }
      case '"':
        $node = new InterpolatedStringNode();
        $this->mustMatch('"', $node);
        $this->encapsList($node, '"');
        $this->mustMatch('"', $node);
        return $node;
      case T_STRING:
      case T_NS_SEPARATOR:
      case T_NAMESPACE:
        $namespace_path = $this->name();
        if ($this->currentType === T_DOUBLE_COLON) {
          return $this->exprClass($namespace_path);
        }
        elseif ($this->currentType === '(') {
          return $this->functionCall($namespace_path);
        }
        else {
          $constant_name = strtolower($namespace_path->getText());
          if ($constant_name === 'true') {
            $node = new TrueNode();
          }
          elseif ($constant_name === 'false') {
            $node = new FalseNode();
          }
          elseif ($constant_name === 'null') {
            $node = new NullNode();
          }
          else {
            $node = new ConstantNode();
          }
          $node->addChild($namespace_path, 'constantName');
          return $node;
        }
      case T_STATIC:
        $static = $this->mustMatchToken(T_STATIC);
        if ($this->currentType === T_FUNCTION) {
          return $this->anonymousFunction($static);
        } else {
          return $this->exprClass($static);
        }
      case '$':
      case T_VARIABLE:
        $operand = $this->indirectReference();
        if (!($operand instanceof VariableVariableNode) && $this->currentType === T_DOUBLE_COLON) {
          return $this->exprClass($operand);
        }
        elseif ($this->currentType === '(') {
          return $this->functionCall($operand, TRUE);
        }
        else {
          return $this->objectDereference($operand);
        }
      case T_ISSET:
        $node = new IssetNode();
        $this->mustMatch(T_ISSET, $node, 'name');
        $arguments = new CommaListNode();
        $this->mustMatch('(', $node, 'openParen');
        $node->addChild($arguments, 'arguments');
        do {
          $arguments->addChild($this->variable());
        } while ($this->tryMatch(',', $arguments));
        $this->mustMatch(')', $node, 'closeParen', TRUE);
        return $node;
      case T_EMPTY:
      case T_EVAL:
        if ($this->currentType === T_EMPTY) {
          $node = new EmptyNode();
        }
        else {
          $node = new EvalNode();
        }
        $this->mustMatch($this->currentType, $node, 'name');
        $arguments = new CommaListNode();
        $this->mustMatch('(', $node, 'openParen');
        $node->addChild($arguments, 'arguments');
        $arguments->addChild($this->expr());
        $this->mustMatch(')', $node, 'closeParen', TRUE);
        return $node;
      case T_INCLUDE:
      case T_REQUIRE:
      case T_INCLUDE_ONCE:
      case T_REQUIRE_ONCE:
        if ($this->currentType === T_INCLUDE) {
          $node = new IncludeNode();
        }
        elseif ($this->currentType === T_INCLUDE_ONCE) {
          $node = new IncludeOnceNode();
        }
        elseif ($this->currentType === T_REQUIRE) {
          $node = new RequireNode();
        }
        else {
          $node = new RequireOnceNode();
        }
        $this->mustMatch($this->currentType, $node);
        $node->addChild($this->expr(), 'expression');
        return $node;
      case T_NEW:
        return $this->newExpr();
      case T_LIST:
        return $this->_list();
      case T_EXIT:
        $node = new ExitNode();
        $this->mustMatch(T_EXIT, $node, NULL, TRUE);
        if ($this->currentType !== '(') {
          return $node;
        }
        $this->mustMatch('(', $node, 'openParen');
        if ($this->tryMatch(')', $node, 'closeParen', TRUE)) {
          return $node;
        }
        if ($this->currentType === T_YIELD) {
          $node->addChild($this->_yield(), 'expression');
        }
        else {
          $node->addChild($this->expr(), 'expression');
        }
        $this->mustMatch(')', $node, 'closeParen', TRUE);
        return $node;
      case T_FUNCTION:
        return $this->anonymousFunction();
      case '`':
        return $this->backtick();
    }
    throw new ParserException(
      $this->filename,
      $this->iterator->getLineNumber(),
      $this->iterator->getColumnNumber(),
      "excepted expression operand but got " . $this->current->getTypeName());
  }
263200
public function getInitialValue()
    {
        if ($this->hasDefaultValue) {
            return $this->defaultValue;
        }

        return $this->isNullable ? null : $this->dataType->getInitialValue();
    }
47734
public function getPhpDefaultValue()
    {
        if ($this->defaultValue === null) {
            return null;
        }

        if ($this->defaultValue->isExpression()) {
            throw new EngineException("Cannot get PHP version of default value for default value EXPRESSION.");
        }

        if ($this->propelType === PropelTypes::BOOLEAN || $this->propelType === PropelTypes::BOOLEAN_EMU) {
            return $this->booleanValue($this->defaultValue->getValue());
        }

        if (PropelTypes::PHP_ARRAY === $this->propelType) {
            return $this->getDefaultValueForArray($this->defaultValue->getValue());
        }

        return $this->defaultValue->getValue();
    }
1241037
public static function getDefault()
    {
        if (isset(self::$instance)) {
            return self::$instance;
        }
        self::$instance = new self();
        return self::$instance;
    }
221285
public function getValueType()
	{
		$xmlType =SchemaTypes::getInstance()->getTypeForDOMNode( $this->domNode );
		// $xmlType = $this->types->getType( $this->domNode->localName, $this->domNode->prefix );
		if ( $xmlType )
		{
			$type = Type::XmlTypeToPHPType( $xmlType );
			if ( $type ) return $type;
		}
		return Type::string;
	}
1298825
public function getDefault() {
        // timestamp default
        if ($this->default === Schema::DF_CURRENT_TIMESTAMP) {
            // check for right datatpye
            $stamp_type = $this->findQuery($this->schema->dataTypes['TIMESTAMP']);
            if ($this->type != 'TIMESTAMP' &&
                ($this->passThrough && strtoupper($this->type) != strtoupper($stamp_type))
            )
                trigger_error(self::TEXT_CurrentStampDataType,E_USER_ERROR);
            return $this->findQuery($this->schema->defaultTypes[strtoupper($this->default)]);
        } else {
            // static defaults
            $type_val = $this->getTypeVal();
            $pdo_type = preg_match('/int|bool/i', $type_val, $parts) ?
                constant('\PDO::PARAM_'.strtoupper($parts[0])) : \PDO::PARAM_STR;
            return ($this->default === NULL ? 'NULL' :
                $this->db->quote(htmlspecialchars($this->default, ENT_QUOTES,
                    \Base::instance()->get('ENCODING')), $pdo_type));
        }
    }
1007094
public static function getDefault()
    {
        if (static::$_default != null) {
            return static::$_default;
        }

        // check if running into laravel context
        if (Context::checkLaravel()) {
            static::$_default = new self(['socket' => 'Laravel']);

            return static::$_default;
        }

        // check if registered container
        if (Context::checkContainer()) {
            return Context::getContainerDatabase();
        }
    }
703637
private function normalizeDefault()
    {
        if ($this->hasDefaultValue()) {
            if (preg_match('/^\'?(.*?)\'?::(.+)/', $this->defaultValue, $matches)) {
                //In database: 'value'::TYPE
                $this->defaultValue = $matches[1];
            } elseif ($this->type == 'bit') {
                $this->defaultValue = bindec(
                    substr($this->defaultValue, 2, strpos($this->defaultValue, '::') - 3)
                );
            } elseif ($this->type == 'boolean') {
                $this->defaultValue = (strtolower($this->defaultValue) == 'true');
            }

            if ($this->getType() == self::FLOAT || $this->getType() == self::INT) {
                if (preg_match('/^\(?(.*?)\)?(?!::(.+))?$/', $this->defaultValue, $matches)) {
                    //Negative numeric values
                    $this->defaultValue = $matches[1];
                }

                return;
            }
        }
    }
1010304
public function getDefaultValue()
    {
        if (null !== $this->defaultChildren) {
            $default = $this->prototype->hasDefaultValue() ? $this->prototype->getDefaultValue() : [];
            $defaults = [];
            foreach (array_values($this->defaultChildren) as $i => $name) {
                $defaults[null === $this->keyAttribute ? $i : $name] = $default;
            }

            return $defaults;
        }

        return $this->defaultValue;
    }
902643
public function getDefaultValue()
    {
        if (!$this->hasDefaultValue()) {
            return null;
        }

        if ($this->defaultValue instanceof FragmentInterface) {
            //Defined as SQL piece
            return $this->defaultValue;
        }

        if (in_array($this->getAbstractType(), ['time', 'date', 'datetime', 'timestamp'])) {
            return $this->formatDatetime($this->getAbstractType(), $this->defaultValue);
        }

        switch ($this->getType()) {
            case 'int':
                return (int)$this->defaultValue;
            case 'float':
                return (float)$this->defaultValue;
            case 'bool':
                if (is_string($this->defaultValue) && strtolower($this->defaultValue) == 'false') {
                    return false;
                }

                return (bool)$this->defaultValue;
        }

        return (string)$this->defaultValue;
    }