diff --git a/Extractor/ApiDocExtractor.php b/Extractor/ApiDocExtractor.php index e338fe9..d53dc1d 100644 --- a/Extractor/ApiDocExtractor.php +++ b/Extractor/ApiDocExtractor.php @@ -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'; diff --git a/Tests/Extractor/ApiDocExtratorTest.php b/Tests/Extractor/ApiDocExtratorTest.php index eee99dd..e90bc95 100644 --- a/Tests/Extractor/ApiDocExtratorTest.php +++ b/Tests/Extractor/ApiDocExtratorTest.php @@ -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() + ); + } } diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index 4c42042..53d57fb 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -154,4 +154,12 @@ class TestController public function cachedAction() { } + + /** + * @ApiDoc() + * @deprecated + */ + public function deprecatedAction() + { + } }