Variadic parameters in PHP8 can have int|string key#725
Variadic parameters in PHP8 can have int|string key#725ondrejmirtes merged 1 commit intophpstan:masterfrom
Conversation
ed31761 to
e6514e7
Compare
src/Analyser/MutatingScope.php
Outdated
There was a problem hiding this comment.
I'm pondering if it should be a benevolent union type or not. Maybe we want a normal union type so that the user always finds out about a possible bug?
There was a problem hiding this comment.
I changed it to UnionType and it found an error in PHPStan itself here. (Parameter #3 $length of function array_slice expects int|null, int|string given.)
Which kinda makes sense I guess. But it can also be considered false positive? With BenevolentUnion it wouldn't complain.
There was a problem hiding this comment.
That's great, we should actually do $types = array_values($types); as the first thing in the method.
There was a problem hiding this comment.
Why it's no longer tested on PHP 8+? If there are different asserts, please create bug-2600-php8.php for that.
There was a problem hiding this comment.
Why it's no longer tested on PHP 8+? If there are different asserts, please create bug-4902-php8.php for that.
e6514e7 to
399eeb5
Compare
399eeb5 to
b6a6d13
Compare
|
Thank you! |
This PR is an attempt to fix phpstan/phpstan#4850
When injecting
PhpVersioninto theMutatingScopeconstructor, I had to change a lot of other places. Hope that's ok.And I used
$this->phpVersion->supportsNamedArguments()because it's a side effect of the named arguments feature. But if you like, I can add another method with different name.