Skip to content

Commit 7c8b794

Browse files
phpstan-botclaude
andcommitted
Add non-regression test for phpstan/phpstan#13623
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b3b3175 commit 7c8b794

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace Bug13623;
6+
7+
use function PHPStan\Testing\assertType;
8+
9+
function (array $results): void {
10+
$customers = [];
11+
12+
foreach ($results as $row) {
13+
$customers[$row['customer_id']] ??= [];
14+
$customers[$row['customer_id']]['orders'] ??= [];
15+
$customers[$row['customer_id']]['orders'][$row['order_id']] ??= [];
16+
17+
$customers[$row['customer_id']]['orders'][$row['order_id']]['balance_forward'] ??= 0;
18+
$customers[$row['customer_id']]['orders'][$row['order_id']]['new_invoice'] ??= 0;
19+
$customers[$row['customer_id']]['orders'][$row['order_id']]['payments'] ??= 0;
20+
$customers[$row['customer_id']]['orders'][$row['order_id']]['balance'] ??= $row['order_total'];
21+
}
22+
23+
assertType("array<array{orders: array<array{}|array{balance_forward?: 0, new_invoice?: 0, payments?: 0, balance?: mixed}>}>", $customers);
24+
};

0 commit comments

Comments
 (0)