Bug report
When using an anonymous function with a reference in use , the value checked is the value at the time of function declaration and ignores that the value may change.
https://phpstan.org/r/920ed53d-18a7-477d-b478-accfc6f8e8be
<?php
$tmpdir = "";
$myfunc = function () use (&$tmpdir) {
if ($tmpdir !== "" && file_exists($tmpdir)) {
echo $tmpdir;
}
};
$tmpdir = "/tmp/my/useful/tempdir";
$myfunc();
Gives
Result of && is always false.
Strict comparison using !== between '' and '' will always evaluate to false.
Code snippet that reproduces the problem
https://phpstan.org/r/920ed53d-18a7-477d-b478-accfc6f8e8be
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
When using an anonymous function with a reference in use , the value checked is the value at the time of function declaration and ignores that the value may change.
https://phpstan.org/r/920ed53d-18a7-477d-b478-accfc6f8e8be
Gives
Code snippet that reproduces the problem
https://phpstan.org/r/920ed53d-18a7-477d-b478-accfc6f8e8be
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
No response