Passing a variable by reference to a function and method has side effects#1990
Passing a variable by reference to a function and method has side effects#1990ondrejmirtes merged 7 commits intophpstan:1.9.xfrom
Conversation
ryium
commented
Nov 10, 2022
- fixes PHP 8.0 - throw statement is now throw expression, it can throw at any point phpstan#8084
|
This pull request has been marked as ready for review. |
ondrejmirtes
left a comment
There was a problem hiding this comment.
Could you please test and fix other similar functions that might have the same issue? array_push, array_unshift, array_pop, array_splice
|
And maybe it'd be a better to idea to do this in |
| { | ||
| public function run(array $arr): void | ||
| { | ||
| /** @var array{a: 0, b?: 1} $arr */ |
There was a problem hiding this comment.
Hi, please put this type into @param above the method, here it's ambiguous what it means.
Also currently this example https://phpstan.org/r/de642079-e5b0-492a-9782-d78c324f70a7 shows Expression on left side of ?? is not nullable. so we'll need another test in NullCoalesceRuleTest to make sure this message goes away.
Thank you!
There was a problem hiding this comment.
Hi, thank you for your review.
Added a test, but included a merge commit to follow the latest branch.
Should I recreate?
3573186 to
4115456
Compare
|
Brought it over the finish line :) Thank you. |
|
Sorry, I had to revert this, it led to some false positives. |