-
Notifications
You must be signed in to change notification settings - Fork 61
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
Newlines stops consuming tag descriptions #241
Comments
Have you tried setting These options are similar to PHPStan's bleeding edge. Right now they're set to false for BC reasons but they will be removed in 2.0 and code will behave the new modern way (as if these options were set to true). Also check out options in TypeParser and ConstExprParser. |
Yes I did check those settings, those resulted in the same behavior. |
I checked again... since I was using the parser just for a single tag this caused issues. So I do have a workaround that works for us right now. As we can simply consume all tokens from the lexer. Which brings me to another issue, which might be one you also are facing when reconstructing docblocks. When I have a docblock line like this:
The token on line 2 contains: We fixed this by adding some post processing on the tokens:
But I think this is a bug in the way phpstan parses the docblocks. This expression: Do you think it's worth fixing this? |
I think this works as expected. We even have tests for: * @param string $myParam this is a description of the param
*
* And this line also belongs to $myParam.
* @param array $other this is a new param.
* And everything up up until |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I got an issue report on my project phpDocumentor/ReflectionDocBlock#365 where we found an issue in this parser. Summarized the users are facing an issue with tag descriptions containing empty lines.
Newlines in tag descriptions are possible, but when the newline is detected the parser stops consuming new tokens. While if should only stop when a new tag starts. Other reported issues are more or less out of scope of this issue and I can workaround them. But the situation with the newlines cannot be patched from the outside. To prove the solution I made an ugly hack in our code to see if we can overcome this issue by just adjusting a single method.
phpDocumentor/ReflectionDocBlock#369
The POC shows that the method getSkippedHorizontalWhiteSpaceIfAny is not working when the detected token is processed as a newline token. As a result the leading whitespace between
param
andAnd
in my example is removed by the parser.I would be able to create a PR to solve this issue. But before I invest more time I would like to see if other solutions are already available.
The text was updated successfully, but these errors were encountered: