public function getTempLocalVariableForWrite($type, CompilationContext $context)
{
$variable = $this->reuseTempVariable($type, 'stack');
if (is_object($variable)) {
$variable->increaseUses();
$variable->increaseMutates();
$variable->setLocalOnly(true);
if ($type == 'variable' || $type == 'string' || $type == 'array') {
$variable->initVariant($context);
}
return $variable;
}
$tempVar = $this->getNextTempVar();
$variable = $this->addVariable($type, '_' . $tempVar, $context);
$variable->setIsInitialized(true, $context, array());
$variable->increaseUses();
$variable->increaseMutates();
$variable->setLocalOnly(true);
$variable->setTemporal(true);
if ($type == 'variable' || $type == 'string' || $type == 'array') {
$variable->initVariant($context);
}
$this->registerTempVariable($type, 'stack', $variable);
return $variable;
}