mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Applied multi line fixes to @param, analogous to those in @return.
This commit is contained in:
@@ -36,7 +36,12 @@ class ParamTag extends ReturnTag
|
||||
{
|
||||
$this->tag = $type;
|
||||
$this->content = $content;
|
||||
$content = preg_split('/\s+/u', $content);
|
||||
$content = preg_split(
|
||||
'/(\s+)/u',
|
||||
trim($content),
|
||||
3,
|
||||
PREG_SPLIT_DELIM_CAPTURE
|
||||
);
|
||||
|
||||
// if the first item that is encountered is not a variable; it is a type
|
||||
if (isset($content[0])
|
||||
@@ -44,6 +49,7 @@ class ParamTag extends ReturnTag
|
||||
&& ($content[0][0] !== '$')
|
||||
) {
|
||||
$this->type = array_shift($content);
|
||||
array_shift($content);
|
||||
}
|
||||
|
||||
// if the next item starts with a $ it must be the variable name
|
||||
@@ -52,6 +58,7 @@ class ParamTag extends ReturnTag
|
||||
&& ($content[0][0] == '$')
|
||||
) {
|
||||
$this->variableName = array_shift($content);
|
||||
array_shift($content);
|
||||
}
|
||||
|
||||
$this->description = implode('', $content);
|
||||
|
||||
@@ -76,6 +76,15 @@ class ParamTagTest extends \PHPUnit_Framework_TestCase
|
||||
'param', 'int $bob Number of bobs', 'int', array('int'), '$bob',
|
||||
'Number of bobs'
|
||||
),
|
||||
array('param', "int Description \n on multiple lines", 'int',
|
||||
array('int'), '', "Description \n on multiple lines"
|
||||
),
|
||||
array('param', "int \n\$bob Variable name on a new line", 'int',
|
||||
array('int'), '$bob', "Variable name on a new line"
|
||||
),
|
||||
array('param', "\nint \$bob Type on a new line", 'int',
|
||||
array('int'), '$bob', "Type on a new line"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user