public function convert(\DOMElement $parent, ConstantDescriptor $constant)
    {
        $fullyQualifiedNamespaceName = $constant->getNamespace() instanceof NamespaceDescriptor
            ? $constant->getNamespace()->getFullyQualifiedStructuralElementName()
            : $parent->getAttribute('namespace');

        $child = new \DOMElement('constant');
        $parent->appendChild($child);

        $child->setAttribute('namespace', ltrim($fullyQualifiedNamespaceName, '\\'));
        $child->setAttribute('line', $constant->getLine());

        $child->appendChild(new \DOMElement('name', $constant->getName()));
        $child->appendChild(new \DOMElement('full_name', $constant->getFullyQualifiedStructuralElementName()));
        $child->appendChild(new \DOMElement('value'))->appendChild(new \DOMText($constant->getValue()));

        $this->docBlockConverter->convert($child, $constant);

        return $child;
    }