Skip to content

Commit 46103ad

Browse files
committed
Test
1 parent 73e2706 commit 46103ad

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public function testRule(): void
4141
'Offset 2 does not exist on array(1, 2).',
4242
15,
4343
],
44+
[
45+
'Offset \'a\' does not exist on array(\'b\' => 1).',
46+
22,
47+
],
4448
]);
4549
}
4650

tests/PHPStan/Rules/Arrays/data/array-destructuring.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ public function doFoo(?array $arrayOrNull): void
1515
[[$a, $b, $c]] = [[1, 2]];
1616
}
1717

18+
public function doBar(): void
19+
{
20+
['a' => $a] = ['a' => 1];
21+
22+
['a' => $a] = ['b' => 1];
23+
}
24+
1825
}

0 commit comments

Comments
 (0)