src/AbstractBlock.php
public function changeObjectType($newType)
    {
        $object = $this->factory->create($newType)
            ->setContent($this->getContent())
            ->setLineNumber($this->getLineNumber())
        ;

        return $object;
    }
public function changeObjectType($newType)
    {
        $object = $this->factory->create($newType)
            ->setContent($this->getContent())
            ->setLineNumber($this->getLineNumber())
        ;

        return $object;
    }
@param string $newType

@return BlockInterface