bug: Fix non-parenthesized callable return type parse#6961
Merged
kubawerlos merged 4 commits intoPHP-CS-Fixer:masterfrom May 18, 2023
Merged
bug: Fix non-parenthesized callable return type parse#6961kubawerlos merged 4 commits intoPHP-CS-Fixer:masterfrom
kubawerlos merged 4 commits intoPHP-CS-Fixer:masterfrom
Conversation
a4ce67e to
e4d8994
Compare
Wirone
reviewed
May 18, 2023
Member
Wirone
left a comment
There was a problem hiding this comment.
\Closure: int|floatmust be parsed as(\Closure: int) | float
Can you share reference to the source stating this? The other day I saw discussion about it and people weren't completely sure how it should be treated, I have doubts too. It's important, because it's either bug fix or BC break 😅.
Contributor
Author
see phpstan/phpstan#9268, this is how it must be dumped and how it is parsed already by static analysers given this fact, a callable return type union requires parenthesis proof: https://phpstan.org/r/afa05b01-9dc1-4f74-b8b0-45d259a944e8 |
Wirone
reviewed
May 18, 2023
Wirone
approved these changes
May 18, 2023
Member
Contributor
|
thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
\Closure: int|floatmust be parsed as(\Closure: int) | floatParenthesized type can be parsed as of #6796.
TypeExpressionTest::testGetTypesis improved to test if the type is really split/parsed as expected.Also fix empty string parse (
'',"").