Zephir\Call::mustInitSymbolVariable PHP Method

mustInitSymbolVariable() public method

Returns if the symbol to be returned by the call must be initialized
public mustInitSymbolVariable ( ) : boolean
return boolean
    public function mustInitSymbolVariable()
    {
        return $this->_mustInit;
    }

Usage Example

Example #1
0
 /**
  * @param array $expression
  * @param Call $call
  * @param CompilationContext $context
  * @return bool|CompiledExpression|mixed
  * @throws CompilerException
  */
 public function optimize(array $expression, Call $call, CompilationContext $context)
 {
     /* microtime has one optional parameter (get_as_float) */
     if (isset($expression['parameters']) && count($expression['parameters']) > 2) {
         return false;
     }
     /**
      * Process the expected symbol to be returned
      */
     $call->processExpectedReturn($context);
     $symbolVariable = $call->getSymbolVariable(true, $context);
     if ($symbolVariable->isNotVariableAndString()) {
         throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression);
     }
     $context->headersManager->add('kernel/time');
     $symbol = $context->backend->getVariableCode($symbolVariable);
     if (!isset($expression['parameters'])) {
         $symbolVariable->setDynamicTypes('string');
         if ($call->mustInitSymbolVariable()) {
             $symbolVariable->initVariant($context);
         }
         $context->codePrinter->output('zephir_microtime(' . $symbol . ', NULL TSRMLS_CC);');
     } else {
         $symbolVariable->setDynamicTypes('double');
         $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);
         if ($call->mustInitSymbolVariable()) {
             $symbolVariable->initVariant($context);
         }
         $context->codePrinter->output('zephir_microtime(' . $symbol . ', ' . $resolvedParams[0] . ' TSRMLS_CC);');
     }
     return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression);
 }
All Usage Examples Of Zephir\Call::mustInitSymbolVariable