Merge pull request #180 from lightglitch/deprecated

Added support for deprecated phpdoc tag
This commit is contained in:
William Durand 2013-04-16 12:30:26 -07:00
commit c5971321cc
3 changed files with 23 additions and 0 deletions

View File

@ -320,6 +320,9 @@ class ApiDocExtractor
if (preg_match('{^@param (.+)}', trim($line), $matches)) {
$paramDocs[] = $matches[1];
}
if (preg_match('{^@deprecated\b(.*)}', trim($line), $matches)) {
$annotation->setDeprecated(true);
}
}
$regexp = '{(\w*) *\$%s *(.*)}i';

View File

@ -179,4 +179,16 @@ class ApiDocExtractorTest extends WebTestCase
$annotation->getCache()
);
}
public function testGetWithDeprecated()
{
$container = $this->getContainer();
$extractor = $container->get('nelmio_api_doc.extractor.api_doc_extractor');
$annotation = $extractor->get('Nelmio\ApiDocBundle\Tests\Fixtures\Controller\TestController::DeprecatedAction', 'test_route_14');
$this->assertNotNull($annotation);
$this->assertTrue(
$annotation->getDeprecated()
);
}
}

View File

@ -154,4 +154,12 @@ class TestController
public function cachedAction()
{
}
/**
* @ApiDoc()
* @deprecated
*/
public function deprecatedAction()
{
}
}