Add basic support for new-in-initializer#238
Add basic support for new-in-initializer#238rvanvelzen wants to merge 1 commit intophpstan:1.23.xfrom
Conversation
|
Could you explain what this has to do with optional or non-nullable parameters?
While this is true, for default values in regular code generics aren't taken into account either. So implementing this in PHPStan itself is just a few lines of code. |
|
They are: https://phpstan.org/r/fe352005-91ed-4021-bd95-9d6df9f886a4 (and not generalized on bleeding edge https://phpstan.org/r/7fad672b-f8b0-4128-9282-d82a6599f2b6, unless in GenericObjectType). |
I don't really get the question, because the answer is "everything"? This syntax applies only to default value of parameters in |
Ah, I actually meant that the default value itself is never generic: https://phpstan.org/r/dc1fee3f-b8de-448d-ba24-edc733770921 I think I understand what you're trying to figure out, and I think the short answer is: this is only to indicate that such a parameter has a default value, which is impossible otherwise right now. Not really relevant for analysis. But this is nice and simple and mirrors the native syntax precisely. :) |
ondrejmirtes
left a comment
There was a problem hiding this comment.
This needs some changes in Printer too. At least definitely a one in $listInsertionMap and maybe more.
Not all entries in that property are tested, but if you comment ArrayShapeNode::class . '->items' => ', ', you'll see the kind of test I'd like to see. It's somewhere around $addItemsToArrayShape in PrinterTest. Thanks!
4c28423 to
cb43a7f
Compare

Implementation for #173