Skip to content

Commit 48339e2

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 0ecdd06 commit 48339e2

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,15 @@ public function testBug13279(): void
15071507
$this->assertSame('Parameter #2 $offset of function array_splice expects int, string given.', $errors[0]->getMessage());
15081508
}
15091509

1510+
public function testBug13310(): void
1511+
{
1512+
// require file to make sure the defined function is known
1513+
require_once __DIR__ . '/data/bug-13310.php';
1514+
1515+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-13310.php');
1516+
$this->assertNoErrors($errors);
1517+
}
1518+
15101519
/**
15111520
* @param string[]|null $allAnalysedFiles
15121521
* @return Error[]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Bug13310;
4+
5+
/**
6+
* @return array<mixed>
7+
*/
8+
function get_array(): array
9+
{
10+
return [];
11+
}
12+
13+
$tests = get_array();
14+
15+
foreach ($tests as $test) {
16+
17+
// information fichiers
18+
$test['information'] = '';
19+
$test['information'] .= $test['a'] ? 'test' : '';
20+
$test['information'] .= $test['b'] ? 'test' : '';
21+
$test['information'] .= $test['c'] ? 'test' : '';
22+
$test['information'] .= $test['d'] ? 'test' : '';
23+
$test['information'] .= $test['e'] ? 'test' : '';
24+
$test['information'] .= $test['f'] ? 'test' : '';
25+
$test['information'] .= $test['g'] ? 'test' : '';
26+
$test['information'] .= $test['h'] ? 'test' : '';
27+
28+
}

0 commit comments

Comments
 (0)