Add support in docblocks for @param with no description

This commit is contained in:
Adrien BRAULT 2012-05-07 12:51:22 +02:00
parent 3a7bf7ce41
commit be3dca0c47
5 changed files with 10 additions and 5 deletions

View File

@ -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) {

View File

@ -59,6 +59,7 @@ class TestController
* @ApiDoc()
*
* @param int $id A nice comment
* @param int $page
*/
public function myCommentedAction()
{

View File

@ -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:

View File

@ -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} ###

View File

@ -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.',
),