Library/ClassProperty.php
protected function declareProperty(CompilationContext $compilationContext, $type, $value)
    {
        $codePrinter = $compilationContext->codePrinter;

        if (\is_object($value)) {
            return;
        }

        $classEntry = $compilationContext->classDefinition->getClassEntry();

        switch ($type) {
            case 'long':
            case 'int':
                $codePrinter->output('zend_declare_property_long('.$classEntry.', SL("'.$this->getName().'"), '.$value.', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case 'double':
                $codePrinter->output('zend_declare_property_double('.$classEntry.', SL("'.$this->getName().'"), '.$value.', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case 'bool':
                $codePrinter->output('zend_declare_property_bool('.$classEntry.', SL("'.$this->getName().'"), '.$this->getBooleanCode($value).', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case Types::T_CHAR:
            case Types::T_STRING:
                $codePrinter->output(
                    sprintf(
                        'zend_declare_property_string(%s, SL("%s"), "%s", %s TSRMLS_CC);',
                        $classEntry,
                        $this->getName(),
                        add_slashes($value),
                        $this->getVisibilityAccessor()
                    )
                );
                break;

            case 'array':
            case 'empty-array':
            case 'null':
                $codePrinter->output('zend_declare_property_null('.$classEntry.', SL("'.$this->getName().'"), '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            default:
                throw new CompilerException('Unknown default type: '.$type, $this->original);
        }
    }
protected function declareProperty(CompilationContext $compilationContext, $type, $value)
    {
        $codePrinter = $compilationContext->codePrinter;

        if (\is_object($value)) {
            return;
        }

        $classEntry = $compilationContext->classDefinition->getClassEntry();

        switch ($type) {
            case 'long':
            case 'int':
                $codePrinter->output('zend_declare_property_long('.$classEntry.', SL("'.$this->getName().'"), '.$value.', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case 'double':
                $codePrinter->output('zend_declare_property_double('.$classEntry.', SL("'.$this->getName().'"), '.$value.', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case 'bool':
                $codePrinter->output('zend_declare_property_bool('.$classEntry.', SL("'.$this->getName().'"), '.$this->getBooleanCode($value).', '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            case Types::T_CHAR:
            case Types::T_STRING:
                $codePrinter->output(
                    sprintf(
                        'zend_declare_property_string(%s, SL("%s"), "%s", %s TSRMLS_CC);',
                        $classEntry,
                        $this->getName(),
                        add_slashes($value),
                        $this->getVisibilityAccessor()
                    )
                );
                break;

            case 'array':
            case 'empty-array':
            case 'null':
                $codePrinter->output('zend_declare_property_null('.$classEntry.', SL("'.$this->getName().'"), '.$this->getVisibilityAccessor().' TSRMLS_CC);');
                break;

            default:
                throw new CompilerException('Unknown default type: '.$type, $this->original);
        }
    }
protected function declareProperty ( CompilationContext $ compilationContext , $ type , $ value ) { $ codePrinter = $ compilationContext -> codePrinter ; if ( \ is_object ( $ value ) ) { return ; } $ classEntry = $ compilationContext -> classDefinition -> getClassEntry ( ) ; switch ( $ type ) { case 'long' : case 'int' : $ codePrinter -> output ( 'zend_declare_property_long(' . $ classEntry . ', SL("' . $ this -> getName ( ) . '"), ' . $ value . ', ' . $ this -> getVisibilityAccessor ( ) . ' TSRMLS_CC);' ) ; break ; case 'double' : $ codePrinter -> output ( 'zend_declare_property_double(' . $ classEntry . ', SL("' . $ this -> getName ( ) . '"), ' . $ value . ', ' . $ this -> getVisibilityAccessor ( ) . ' TSRMLS_CC);' ) ; break ; case 'bool' : $ codePrinter -> output ( 'zend_declare_property_bool(' . $ classEntry . ', SL("' . $ this -> getName ( ) . '"), ' . $ this -> getBooleanCode ( $ value ) . ', ' . $ this -> getVisibilityAccessor ( ) . ' TSRMLS_CC);' ) ; break ; case Types :: T_CHAR : case Types :: T_STRING : $ codePrinter -> output ( sprintf ( 'zend_declare_property_string(%s, SL("%s"), "%s", %s TSRMLS_CC);' , $ classEntry , $ this -> getName ( ) , add_slashes ( $ value ) , $ this -> getVisibilityAccessor ( ) ) ) ; break ; case 'array' : case 'empty-array' : case 'null' : $ codePrinter -> output ( 'zend_declare_property_null(' . $ classEntry . ', SL("' . $ this -> getName ( ) . '"), ' . $ this -> getVisibilityAccessor ( ) . ' TSRMLS_CC);' ) ; break ; default : throw new CompilerException ( 'Unknown default type: ' . $ type , $ this -> original ) ; } }
Declare class property with default value.

@param CompilationContext $compilationContext
@param string             $type
@param $value

@throws CompilerException
Declare class property with default value .