Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #55 from vimeo/markdown-param-descriptions
Browse files Browse the repository at this point in the history
Restricting the parameter annotation enum values regex. #53
  • Loading branch information
erunion committed Apr 12, 2017
2 parents 2613135 + 55847b5 commit be36f8f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
7 changes: 7 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,12 @@
<directory name="tests/" />
</errorLevel>
</MissingReturnType>

<PossiblyInvalidArgument>
<errorLevel type="suppress">
<!-- Masking errors where we're passing methods that return object|bool into test assertions. -->
<directory name="tests/" />
</errorLevel>
</PossiblyInvalidArgument>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Parser/Annotations/ParamAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ParamAnnotation extends Annotation

const REGEX_TYPE = '/^({[^}]*})/';
const REGEX_OPTIONAL = '/(\(optional\))/';
const REGEX_VALUES = '/(\[[^\]]*\])/';
const REGEX_VALUES = '/(\[[^\]]*\])(\ |$)/';

/**
* Name of this parameter's field.
Expand Down
54 changes: 54 additions & 0 deletions tests/Parser/Annotations/ParamAnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,60 @@ public function providerAnnotation()
'version' => '1.1 - 1.2',
'visible' => true
]
],
'_complete' => [
'param' => '{string} content_rating [G|PG|PG-13|R|NC-17|X|NR|UR] (optional) +MOVIE_RATINGS+ ' .
'MPAA rating',
'version' => null,
'visible' => true,
'deprecated' => false,
'expected' => [
'capability' => 'MOVIE_RATINGS',
'deprecated' => false,
'description' => 'MPAA rating',
'field' => 'content_rating',
'required' => false,
'type' => 'string',
'values' => [
'G',
'NC-17',
'NR',
'PG',
'PG-13',
'R',
'UR',
'X'
],
'version' => false,
'visible' => true
]
],
'_complete.with-markdown-description' => [
'param' => '{string} content_rating [G|PG|PG-13|R|NC-17|X|NR|UR] (optional) +MOVIE_RATINGS+ ' .
'[MPAA rating](http://www.mpaa.org/film-ratings/)',
'version' => null,
'visible' => true,
'deprecated' => false,
'expected' => [
'capability' => 'MOVIE_RATINGS',
'deprecated' => false,
'description' => '[MPAA rating](http://www.mpaa.org/film-ratings/)',
'field' => 'content_rating',
'required' => false,
'type' => 'string',
'values' => [
'G',
'NC-17',
'NR',
'PG',
'PG-13',
'R',
'UR',
'X'
],
'version' => false,
'visible' => true
]
]
];
}
Expand Down

0 comments on commit be36f8f

Please sign in to comment.