Closed
Description
Bug report
Hi, I have such example in a code:
$missingArgs = [];
$args = ['username' => 'name', 'password' => 'password'];
$username = $args['username'] ?? $missingArgs[] = 'username';
$password = $args['password'] ?? $missingArgs[] = 'password';
if ($missingArgs) {
//do something
}
Phpstan says that: If condition is always true.
Code snippet that reproduces the problem
https://phpstan.org/r/22616127-39a8-4bbd-874e-1bff9276da26
https://phpstan.org/r/11cebae9-023c-4ea4-bca4-69a03f1e2e50 (https://3v4l.org/Hkrk5)
Expected output
If condition is not always true
Could/should it be fixed in phpstan?