-
Notifications
You must be signed in to change notification settings - Fork 65
Allow new lines in between declarations and also allow multiline union and intersection definition for array shapes #263
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
Conversation
8cdeba3
to
e7ef350
Compare
e7ef350
to
122bb31
Compare
src/Parser/TypeParser.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense to me. The code makes it look like |
and &
could be used in place of ,
in a generic type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to remove this part from the PR and submit it separately, the rest is solid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right it was totally the wrong place.
I moved it accordingly and also adjusted the tests which if I would have had a better look would have already made clear that the parsed information would therefore be wrong 🙈.
I had to adjust the TypeParser::parse
by using savepoints to check whether the union &/ intersection is valid to when being parsed to rollback when somethings feels off due to the information outputted afterwards not being shown "right".
So e.g. parsing /** @return A & B | C */
would had shown a error with partial information missing the beginning showing off a & B | C
instead. (applied on test case invalid with type and disallowed description start token (2)
)
So if you by any chance have a better idea or solution to making this happen I'd be happy about any improvement here.
Otherwise this should now fulfill it's purpose allowing multiline type declarations and other multiline operations that may have led to an error before as stated with the tests and the linked issues that this would solve.
Let me know or feel free to make adjustments yourself if there's something we should do here 👍.
Otherwise thanks for the effort you're putting into all of this ❤️!
...r place and handle them
6ff8fc0
to
61ead7b
Compare
72e51f7
into
phpstan:2.0.x
Nice, thank you!
Uh oh!
There was an error while loading. Please reload this page.
Takes care of: