Zephir\Variable::enableDefaultAutoInitValue PHP Method

enableDefaultAutoInitValue() public method

Sets an automatic safe default init value according to its type
    public function enableDefaultAutoInitValue()
    {
        switch ($this->type) {
            case 'char':
            case 'boolean':
            case 'bool':
            case 'int':
            case 'uint':
            case 'long':
            case 'ulong':
            case 'double':
            case 'zephir_ce_guard':
                $this->defaultInitValue = 0;
                break;
            case 'variable':
            case 'string':
            case 'array':
                $this->defaultInitValue = null;
                $this->setDynamicTypes('null');
                $this->setMustInitNull(true);
                $this->setLocalOnly(false);
                break;
            default:
                throw new CompilerException('Cannot create an automatic safe default value for variable type: ' . $this->type);
        }
    }