From c431e385010e264d41ae28a66ef520e5294354ea Mon Sep 17 00:00:00 2001 From: Jean-Luc Herren Date: Sat, 17 Oct 2020 09:26:20 +0200 Subject: [PATCH] Add regression test for #1924 --- .../PHPStan/Rules/Comparison/data/boolean-and.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/PHPStan/Rules/Comparison/data/boolean-and.php b/tests/PHPStan/Rules/Comparison/data/boolean-and.php index 7f553259b6..f76f429f02 100644 --- a/tests/PHPStan/Rules/Comparison/data/boolean-and.php +++ b/tests/PHPStan/Rules/Comparison/data/boolean-and.php @@ -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'])) { + } +}