Skip to content

Commit

Permalink
Add regression test for #1924
Browse files Browse the repository at this point in the history
  • Loading branch information
jlherren authored and ondrejmirtes committed Oct 18, 2020
1 parent 9ea485b commit c431e38
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/boolean-and.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,18 @@ public function andInIfCondition($mixed, int $i): void
}
}
}

function getMaybeArray() : ?array {
if (rand(0, 1)) { return [1, 2, 3]; }
return null;
}

function bug1924() {
$arr = [
'a' => getMaybeArray(),
'b' => getMaybeArray(),
];

if (isset($arr['a']) && isset($arr['b'])) {
}
}

0 comments on commit c431e38

Please sign in to comment.