Skip to content

Commit 4d84397

Browse files
committed
Added non-regression test
1 parent 3c63f68 commit 4d84397

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
14+
/** @var array<array<string>> $aggregated */
15+
$aggregated = [];
16+
foreach ($joins as $join) {
17+
$aggregated[$s][$hash] = $s;
18+
}
19+
20+
foreach ($aggregated as $sameJoins) {
21+
$first = reset($sameJoins);
22+
assertType('string', $first);
23+
}
24+
}

0 commit comments

Comments
 (0)