1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-02 17:28:27 +01:00
PHP-Parser/test/code/prettyPrinter/expr/arrayDestructuring.test
Nikita Popov 437890d386 PHP 7: Short destructuring syntax
Potentially the pretty printer should force use of [] in assignment
context, instead of relying on the existance of the right attribute.
2016-07-06 23:43:23 +02:00

14 lines
246 B
Plaintext

Array destructuring
-----
<?php
[$a, $b] = [$c, $d];
[, $a, , , $b, ,] = $foo;
[, [[$a]], $b] = $bar;
['a' => $b, 'b' => $a] = $baz;
-----
!!php7
[$a, $b] = [$c, $d];
[, $a, , , $b, ] = $foo;
[, [[$a]], $b] = $bar;
['a' => $b, 'b' => $a] = $baz;