Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Parser fails when parsing @rest\property! #44

Closed
SteenSchutt opened this issue Nov 20, 2019 · 1 comment
Closed

PHP Parser fails when parsing @rest\property! #44

SteenSchutt opened this issue Nov 20, 2019 · 1 comment

Comments

@SteenSchutt
Copy link
Contributor

SteenSchutt commented Nov 20, 2019

The regex on this line:

if (preg_match('~^@' . preg_quote(self::COMMENT_TAG) . '\\\\([a-z][-a-z]*\\??)\\s*(.*)$~', $line, $match) === 1) {

Should be changed to: '~^@' . preg_quote(self::COMMENT_TAG) . '\\\\([a-z][-a-z]*[?!]?)\\s*(.*)$~'

It fails when attempting to parse the following:

/**
 * @rest\definition Account
 * @rest\property! int[0,] id
 */

The resulting matches array looks like this:

Array
(
    [0] => @rest\property! int[0,] id
    [1] => property
    [2] => ! int[0,] id
)

It is expected to look like this:

Array
(
    [0] => @rest\property! int[0,] id
    [1] => property!
    [2] => int[0,] id
)

I am not particularly good with PHPUnit, so feel free to create a test for this case.

SteenSchutt added a commit to SteenSchutt/PHPSwaggerGen that referenced this issue Nov 20, 2019
…dd tests for both optional and readonly suffixes. See vanderlee#44.
@vanderlee
Copy link
Owner

Fixed through your own pull request. Will bump version soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants