public function createNewBlock($blockType, TES5LocalScope $localScope = null) { if ($localScope === null) { $localScope = new TES5LocalScope(); } else { if ($localScope->getParentScope() !== null) { throw new ConversionException("TES5BlockFactory::createNewBlock - Local scope created must be the root, cannot be nested."); } } $newBlock = new TES5EventCodeBlock($blockType, $localScope, $this->codeScopeFactory->createCodeScope($this->blockLocalScopeFactory->createRecursiveScope($localScope))); return $newBlock; }