Skip to content

Commit

Permalink
Allow @param and @return docblock lines more flexibility with whitesp…
Browse files Browse the repository at this point in the history
…ace characters

The regular expressions would not parse @param and @return docblock lines if
they had more than one space character between the tag and its parameters.
The single spaces are replaced with \s+ in the regular expressions to allow
any number of spaces between the tags and their parameters.
  • Loading branch information
tyler-ham committed Sep 25, 2015
1 parent d691d7f commit c312cff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions JsonRpc2/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ private function parseMethodDocComment($method)

$lines = preg_split ('/$\R?^/m', $method->getDocComment());
for ($i=0; $i<count($lines); $i++) {
preg_match("/@param ([\w\\\\\[\]]+) $variableRegex/", $lines[$i], $paramMatches);
preg_match("/@param\s+([\w\\\\\[\]]+)\s+$variableRegex/", $lines[$i], $paramMatches);
if (!empty($paramMatches)) {
$subject = &$this->methodInfo['params'][$paramMatches[2]];
$subject = $infoTpl;
$subject['name'] = $paramMatches[2];
$subject['type'] = $paramMatches[1];
} else {
preg_match("/@return ([\w\\\\\[\]]+)/", $lines[$i], $paramMatches);
preg_match("/@return\s+([\w\\\\\[\]]+)/", $lines[$i], $paramMatches);
if (!empty($paramMatches)) {
$subject = &$this->methodInfo['return'];
$subject = $infoTpl;
Expand Down

0 comments on commit c312cff

Please sign in to comment.