Skip to content

Commit 54159bb

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 038e8b2 commit 54159bb

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,13 @@ public function testBug8649(): void
870870
$this->analyse([__DIR__ . '/data/bug-8649.php'], []);
871871
}
872872

873+
public function testBug11447(): void
874+
{
875+
$this->reportPossiblyNonexistentGeneralArrayOffset = true;
876+
877+
$this->analyse([__DIR__ . '/data/bug-11447.php'], []);
878+
}
879+
873880
public function testNarrowSuperglobals(): void
874881
{
875882
$this->reportPossiblyNonexistentGeneralArrayOffset = true;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Bug11447;
4+
5+
function doFoo() {
6+
\assert( \array_key_exists( 'key1', $_GET ) && \is_numeric( $_GET['key1'] ) );
7+
\assert( isset( $_GET['key2'] ) && \is_numeric( $_GET['key2'] ) );
8+
}

0 commit comments

Comments
 (0)