Issues

ZF-10274: Add annotation-documentation element to wsdl complextype element

Description

I need some special features for my project.

I think it's possible to have documentation for each elements as

 
comment

I don't know if it is a really correct structure for wsdl.

And if type of element is declare as

class IdentiteType {
 /** @var string $siren comment */
 public $siren;
 /** @var int */
 public $id;
 /** @var boolean */
 public $forceVerif;
}

I modify Zend_Soap_Wsdl_Strategy_DefaultComplexType (line 73) and add this code

if ( preg_match('/@var\s+([^\s]+)\s+(\$[^\s]+\s)?(.+)\*/', $property->getDocComment(), $comment) ){
 $annotation = $dom->createElement('xsd:annotation');
 $documentation = $dom->createElement('xsd:documentation', $comment[3]);
 $annotation->appendChild($documentation);
 $element->appendChild($annotation);
}

Other code could be better ....

Comments

Format xml code

class IdentiteType {
 /**
  * Comment
  * @var string
  */
 public $siren;
 /** @var int */
 public $id;
 /** @var boolean */
 public $forceVerif;
}

I change code to respect docBlock rules

$docBlock = preg_replace('/\n/', '', $property->getDocComment() );
if (preg_match('/\/\*\*(.+) \* @var\s+[^\s]+/m', $docBlock, $docBlockMatches)) {
  //Suppression tabulation et autres
  $comment = preg_replace(
    array('/\r/','/\t\s\*/'),
    array('',''), $docBlockMatches[1]
  );
  // Ajout des éléments de documentation au WSDL
  $annotation = $dom->createElement('xsd:annotation');
  $documentation = $dom->createElement('xsd:documentation', $comment);
  $annotation->appendChild($documentation);
  $element->appendChild($annotation);
}