Zephir\Variable::setLocalOnly PHP Method

setLocalOnly() public method

Sets if the variable is local-only scoped
public setLocalOnly ( boolean $localOnly )
$localOnly boolean
    public function setLocalOnly($localOnly)
    {
        $this->localOnly = $localOnly;
    }

Usage Example

Beispiel #1
0
 /**
  * Adds a variable to the symbol table
  *
  * @param int $type
  * @param string $name
  * @param CompilationContext $compilationContext
  * @param mixed $defaultValue
  * @return Variable
  */
 public function addVariable($type, $name, CompilationContext $compilationContext, $defaultValue = null)
 {
     $variable = new Variable($type, $name, $compilationContext->currentBranch, $defaultValue);
     if ($type == 'variable') {
         if ($this->localContext) {
             /**
              * Checks whether a variable can be optimized to be static or not
              */
             if ($this->localContext->shouldBeLocal($name)) {
                 $variable->setLocalOnly(true);
             }
         }
     }
     $this->variables[$name] = $variable;
     return $variable;
 }
All Usage Examples Of Zephir\Variable::setLocalOnly