New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing a variable by reference to a function and method has side effects #1990
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |