diff --git a/Formatter/AbstractFormatter.php b/Formatter/AbstractFormatter.php index 0784bca..107ddb3 100644 --- a/Formatter/AbstractFormatter.php +++ b/Formatter/AbstractFormatter.php @@ -94,7 +94,7 @@ abstract class AbstractFormatter implements FormatterInterface } if (null !== $paramDocs = $route->getOption('_paramDocs')) { - $regexp = '{(\w*) *\$%s +(.*)}i'; + $regexp = '{(\w*) *\$%s *(.*)}i'; foreach ($route->compile()->getVariables() as $var) { $found = false; foreach ($paramDocs as $paramDoc) { diff --git a/Tests/Fixtures/Controller/TestController.php b/Tests/Fixtures/Controller/TestController.php index 49c2fdc..0314e64 100644 --- a/Tests/Fixtures/Controller/TestController.php +++ b/Tests/Fixtures/Controller/TestController.php @@ -59,6 +59,7 @@ class TestController * @ApiDoc() * * @param int $id A nice comment + * @param int $page */ public function myCommentedAction() { diff --git a/Tests/Fixtures/app/config/routing.yml b/Tests/Fixtures/app/config/routing.yml index 1db54c0..7e7b090 100644 --- a/Tests/Fixtures/app/config/routing.yml +++ b/Tests/Fixtures/app/config/routing.yml @@ -19,7 +19,7 @@ test_route_4: defaults: { _controller: NelmioApiDocTestBundle:Test:any, _format: json } test_route_5: - pattern: /my-commented/{id} + pattern: /my-commented/{id}/{page} defaults: { _controller: NelmioApiDocTestBundle:Test:myCommented } test_route_6: diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index bb6eb1b..33b3157 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -112,7 +112,7 @@ _Action without HTTP verb_ -### `ANY` /my-commented/{id} ### +### `ANY` /my-commented/{id}/{page} ### _This method is useful to test if the getDocComment works. And, it supports multilines until the first '@' char._ @@ -122,6 +122,9 @@ _This method is useful to test if the getDocComment works. And, it supports mult - Type: int - Description: A nice comment +**page** + + - Type: int ### `ANY` /yet-another/{id} ### diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index d57769d..0780255 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -149,10 +149,11 @@ class SimpleFormatterTest extends WebTestCase 2 => array( 'method' => 'ANY', - 'uri' => '/my-commented/{id}', + 'uri' => '/my-commented/{id}/{page}', 'requirements' => array( - 'id' => array('type' => 'int', 'description' => 'A nice comment', 'value' => '') + 'id' => array('type' => 'int', 'description' => 'A nice comment', 'value' => ''), + 'page' => array('type' => 'int', 'description' => '', 'value' => ''), ), 'description' => 'This method is useful to test if the getDocComment works. And, it supports multilines until the first \'@\' char.', ),