Merge pull request #555 from damienalexandre/fixLinkParser

Fix the PhpDoc Handler for `@link` annotation and add tests
This commit is contained in:
William Durand 2014-12-12 16:27:51 +01:00
commit a84c53bf6a
3 changed files with 17 additions and 4 deletions

View File

@ -70,10 +70,10 @@ class PhpDocHandler implements HandlerInterface
if (preg_match('{^@param (.+)}', trim($line), $matches)) {
$paramDocs[] = $matches[1];
}
if (preg_match('{^@deprecated\b(.*)}', trim($line), $matches)) {
if (preg_match('{^@deprecated}', trim($line))) {
$annotation->setDeprecated(true);
}
if (preg_match('{^@link\b(.*)}', trim($line), $matches)) {
if (preg_match('{^@link (.+)}', trim($line), $matches)) {
$annotation->setLink($matches[1]);
}
}

View File

@ -314,4 +314,12 @@ class TestController
public function exclusiveAction()
{
}
/**
* @ApiDoc()
* @link http://symfony.com
*/
public function withLinkAction()
{
}
}

View File

@ -234,3 +234,8 @@ test_put_disables_required_parameters:
_method: PUT
_format: json|xml|html
test_route_25:
pattern: /with-link
defaults: { _controller: NelmioApiDocTestBundle:Test:withLinkAction }
requirements:
_method: GET