Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 11, 2021
1 parent 73e2706 commit 46103ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/PHPStan/Rules/Arrays/ArrayDestructuringRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public function testRule(): void
'Offset 2 does not exist on array(1, 2).',
15,
],
[
'Offset \'a\' does not exist on array(\'b\' => 1).',
22,
],
]);
}

Expand Down
7 changes: 7 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/array-destructuring.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ public function doFoo(?array $arrayOrNull): void
[[$a, $b, $c]] = [[1, 2]];
}

public function doBar(): void
{
['a' => $a] = ['a' => 1];

['a' => $a] = ['b' => 1];
}

}

0 comments on commit 46103ad

Please sign in to comment.