protected function visitProperty(PropertyMetadata $metadata, $data, Context $context)
 {
     $v = $metadata->getValue($data);
     if ($metadata->xmlAttribute) {
         $attributeName = $this->namingStrategy->translateName($metadata);
         $this->currentNodes = $this->document->createElement('tmp');
         $context->accept($v, $metadata->type);
         $node = $this->createAttributeNode($metadata, $attributeName);
         $node->appendChild($this->createTextNode((string) $this->currentNodes->nodeValue));
         return $this->currentNodes = $node;
     }
     if ($metadata->xmlValue) {
         $this->currentNodes = $this->document->createElement('tmp');
         $context->accept($v, $metadata->type);
         $node = $this->currentNodes->childNodes->item(0);
         $this->currentNodes->removeChild($node);
         return $this->currentNodes = $node;
     }
     if ($metadata->xmlAttributeMap) {
         $attributes = [];
         foreach ($v as $key => $value) {
             $node = $this->createAttributeNode($metadata, $key);
             $node->appendChild($this->createTextNode((string) $value));
             $attributes[] = $node;
         }
         return $this->currentNodes = $attributes;
     }
     if (null === $v && !$context->shouldSerializeNull()) {
         return $this->currentNodes = null;
     }
     $elementName = $this->namingStrategy->translateName($metadata);
     $this->currentNodes = $this->createElement($metadata->xmlNamespace, $elementName);
     $context->accept($v, $metadata->type);
     if (is_object($v) && null !== $v && !$metadata instanceof AdditionalPropertyMetadata && $context->isVisiting($v)) {
         return $this->currentNodes = null;
     }
     if ($metadata->xmlCollectionInline || $metadata->inline) {
         $children = iterator_to_array($this->currentNodes->childNodes);
         foreach ($children as $childNode) {
             $this->currentNodes->removeChild($childNode);
         }
         $this->currentNodes = $children;
     }
     return $this->currentNodes;
 }