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
Calling non-nullable by-ref param with unset should result in error #1916
Comments
This is more complicated. We have different types of by-ref parameters:
Currently, For this feature request to be fulfilled, we would need to have a third state - "this userland function might create a variable, but check the type anyway". |
But that's erroneous - all userland functions with a declared non-nullable type are function foo(string &$s) : void {}
$bar = [];
foo($bar); |
When only a |
@muglug After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
-No errors
+5: Variable $bar might not be defined. Full report
|
Snippet:
Expected: complain about mismatching non-nullable param with
null
argumentActual: no issue - https://phpstan.org/r/18f1ffe1-738c-46e2-8c57-f10e2e078867
The text was updated successfully, but these errors were encountered: