From 631563582c7dfbc274ea6d81c5494e277475b3a3 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sun, 30 Jan 2022 12:58:04 +0100 Subject: [PATCH] Regression test Closes https://github.com/phpstan/phpstan/issues/4926 --- ...NonexistentOffsetInArrayDimFetchRuleTest.php | 5 +++++ tests/PHPStan/Rules/Arrays/data/bug-4926.php | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/PHPStan/Rules/Arrays/data/bug-4926.php diff --git a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php index 1ddbafce4a..55afd44852 100644 --- a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php @@ -348,4 +348,9 @@ public function testRuleWithNullsafeVariant(): void ]); } + public function testBug4926(): void + { + $this->analyse([__DIR__ . '/data/bug-4926.php'], []); + } + } diff --git a/tests/PHPStan/Rules/Arrays/data/bug-4926.php b/tests/PHPStan/Rules/Arrays/data/bug-4926.php new file mode 100644 index 0000000000..6d5ecb9e8a --- /dev/null +++ b/tests/PHPStan/Rules/Arrays/data/bug-4926.php @@ -0,0 +1,17 @@ +data['customer']['first_name'] ?? null; + } +}