Skip to content

Commit 09eab21

Browse files
herndlmondrejmirtes
authored andcommitted
Add regression test for array self-append
1 parent 621e168 commit 09eab21

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,12 @@ public function testArrayUnion(): void
981981
$this->assertNoErrors($errors);
982982
}
983983

984+
public function testBug6948(): void
985+
{
986+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-6948.php');
987+
$this->assertNoErrors($errors);
988+
}
989+
984990
public function testBug7963(): void
985991
{
986992
$errors = $this->runAnalyse(__DIR__ . '/data/bug-7963.php');
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug6948;
4+
5+
$row = [1];
6+
if (rand()) {
7+
$row[] = $row;
8+
}
9+
if (rand()) {
10+
$row[] = $row;
11+
}
12+
if (rand()) {
13+
$row[] = $row;
14+
}
15+
16+
if (rand()) {
17+
$row[] = $row;
18+
}
19+
if (rand()) {
20+
$row[] = $row;
21+
}
22+
if (rand()) {
23+
$row[] = $row;
24+
}
25+
26+
if (rand()) {
27+
$row[] = $row;
28+
}
29+
if (rand()) {
30+
$row[] = $row;
31+
}
32+
if (rand()) {
33+
$row[] = $row;
34+
}
35+
36+
if (rand()) {
37+
$row[] = $row;
38+
}
39+
if (rand()) {
40+
$row[] = $row;
41+
}
42+
if (rand()) {
43+
$row[] = $row;
44+
}
45+
46+
if (rand()) {
47+
$row[] = $row;
48+
}
49+
if (rand()) {
50+
$row[] = $row;
51+
}
52+
if (rand()) {
53+
$row[] = $row;
54+
}
55+
56+
if (rand()) {
57+
$row[] = $row;
58+
}
59+
if (rand()) {
60+
$row[] = $row;
61+
}
62+
if (rand()) {
63+
$row[] = $row;
64+
}

0 commit comments

Comments
 (0)