Skip to content

Commit 717b9ba

Browse files
authored
Added non-regression test (#5260)
1 parent 3c63f68 commit 717b9ba

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace ResetAfterNonEmptyLoop;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
/**
8+
* @param list<string> $joins
9+
*/
10+
function mergeJoins(array $joins, string $s, string $hash): void
11+
{
12+
if (count($joins) === 0) return;
13+
assertType('non-empty-list<string>', $joins);
14+
15+
/** @var array<array<string>> $aggregated */
16+
$aggregated = [];
17+
foreach ($joins as $join) {
18+
$aggregated[$s][$hash] = $s;
19+
}
20+
assertType('non-empty-array<non-empty-array<string>>', $aggregated);
21+
22+
foreach ($aggregated as $sameJoins) {
23+
$first = reset($sameJoins);
24+
assertType('string', $first);
25+
}
26+
}

0 commit comments

Comments
 (0)