mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #180 from lightglitch/deprecated
Added support for deprecated phpdoc tag
This commit is contained in:
commit
c5971321cc
@ -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';
|
||||
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -154,4 +154,12 @@ class TestController
|
||||
public function cachedAction()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiDoc()
|
||||
* @deprecated
|
||||
*/
|
||||
public function deprecatedAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user