Add multiline generic support#44
Add multiline generic support#44ondrejmirtes merged 5 commits intophpstan:masterfrom icanhazstring:feature/multiline-generics
Conversation
| ]), | ||
| ]; | ||
|
|
||
| yield [ |
There was a problem hiding this comment.
Please add these tests that check for:
- That trailing comma after last element is allowed
- That leading comma at the beginning of the line is also allowed (I know it's ugly but I've seen it in the wild).
Thank you, otherwise 👍
There was a problem hiding this comment.
Ah, sure thing. Will do 👍
There was a problem hiding this comment.
Just a quick question, trailing comma should not work at all am I right?
array<A, B,> is not a correct notation
Where as the leading one should be fine, as long as there are two types given
array<
A
, B
>
There was a problem hiding this comment.
(Kotlin allows trailing comma in generic declarations since 1.4).
There was a problem hiding this comment.
Trailing commas are getting popular and even supported by PHP itself. Since this works: https://phpstan.org/r/e1c07184-7f6d-48ba-99cd-29dd41fe5349, I'm also fine if it will work in generics.
There was a problem hiding this comment.
We shouldn't support multiple trailing commas: A,B,, - that should be an error, otherwise they're fine.
There was a problem hiding this comment.
Thanks for informations. Will add support for them then :)
|
Awesome, love it :) |
|
Released as 0.4.7, but will probably take a few days to be baked into the next release of PHPStan :) |
|
Thanks 🥳 |
Closes phpstan#46. Tests are basically copied and modified from phpstan#44
Closes phpstan#46. Tests are basically copied and modified from phpstan#44
Solve #42