From de6b354fa0e878dccb57b5935dbb18b1f02e6cc5 Mon Sep 17 00:00:00 2001 From: Brown Date: Mon, 17 Aug 2020 15:47:39 -0400 Subject: [PATCH] Fix #4005 - prevent crash when assignment var assertion no longer valid --- tests/Loop/ForTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Loop/ForTest.php b/tests/Loop/ForTest.php index 7eb26ecf3..bd27048c9 100644 --- a/tests/Loop/ForTest.php +++ b/tests/Loop/ForTest.php @@ -125,6 +125,15 @@ class ForTest extends \Psalm\Tests\TestCase } }' ], + 'noException' => [ + ' $arr + */ + function cartesianProduct(array $arr) : void { + for ($i = 20; $arr[$i] === 5 && $i > 0; $i--) {} + }' + ], ]; }