Skip to content

Commit 79e3372

Browse files
committed
Added regression test
1 parent 3e70a3a commit 79e3372

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,4 +930,9 @@ public function testBug12593(): void
930930
$this->analyse([__DIR__ . '/data/bug-12593.php'], []);
931931
}
932932

933+
public function testBug3747(): void
934+
{
935+
$this->analyse([__DIR__ . '/data/bug-3747.php'], []);
936+
}
937+
933938
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Bug3747;
4+
5+
class X {
6+
7+
/** @var array<string,string> $x */
8+
private static array $x;
9+
10+
public function y(): void {
11+
12+
self::$x = [];
13+
14+
$this->z();
15+
16+
echo self::$x['foo'];
17+
18+
}
19+
20+
private function z(): void {
21+
self::$x['foo'] = 'bar';
22+
}
23+
24+
}
25+
26+
$x = new X();
27+
$x->y();

0 commit comments

Comments
 (0)