Skip to content

Commit

Permalink
Improves CommentParser to selectively convert the annotation value to…
Browse files Browse the repository at this point in the history
… array only when array is expected
  • Loading branch information
Arul- committed Jul 19, 2015
1 parent 36f36b9 commit b5bc2dc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion vendor/Luracast/Restler/CommentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ class CommentParser
*/
public static $arrayDelimiter = ',';

/**
* @var array annotations that support array value
*/
public static $allowsArrayValue = array(
'choice' => true,
'select' => true,
);

/**
* character sequence used to escape \@
*/
Expand Down Expand Up @@ -318,7 +326,10 @@ private function parseEmbeddedData($subject)
}
if ($matches[1] == 'pattern') {
throw new Exception('Inline pattern tag should follow {@pattern /REGEX_PATTERN_HERE/} format and can optionally include PCRE modifiers following the ending `/`');
} elseif (false !== strpos($matches[2], static::$arrayDelimiter)) {
} elseif (
isset(static::$allowsArrayValue[$matches[1]]) &&
false !== strpos($matches[2], static::$arrayDelimiter)
) {
$matches[2] = explode(static::$arrayDelimiter, $matches[2]);
}
$data[$matches[1]] = $matches[2];
Expand Down

0 comments on commit b5bc2dc

Please sign in to comment.