From 3e6a47818e0455be7bf100d5e734c58355c3a75e Mon Sep 17 00:00:00 2001 From: Sergey Polischook Date: Sat, 16 Aug 2014 01:59:39 +0300 Subject: [PATCH] Update PhpDocHandler.php https://github.com/nelmio/NelmioApiDocBundle/issues/477 --- Extractor/Handler/PhpDocHandler.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Extractor/Handler/PhpDocHandler.php b/Extractor/Handler/PhpDocHandler.php index f27b5f1..6a6f945 100644 --- a/Extractor/Handler/PhpDocHandler.php +++ b/Extractor/Handler/PhpDocHandler.php @@ -83,10 +83,17 @@ class PhpDocHandler implements HandlerInterface $found = false; foreach ($paramDocs as $paramDoc) { if (preg_match(sprintf($regexp, preg_quote($var)), $paramDoc, $matches)) { - $requirements[$var]['dataType'] = isset($matches[1]) ? $matches[1] : ''; - $requirements[$var]['description'] = $matches[2]; + $annotationRequirements = $annotation->getrequirements(); - if (!isset($requirements[$var]['requirement'])) { + if (!isset($annotationRequirements[$var]['dataType'])) { + $requirements[$var]['dataType'] = isset($matches[1]) ? $matches[1] : ''; + } + + if (!isset($annotationRequirements[$var]['description'])) { + $requirements[$var]['description'] = $matches[2]; + } + + if (!isset($requirements[$var]['requirement']) && !isset($annotationRequirements[$var]['requirement'])) { $requirements[$var]['requirement'] = ''; }