[RFC] Short list syntax #1849
| @@ -5,6 +5,8 @@ | ||
| list($a, list($b)) = array(new stdclass, array(new stdclass)); | ||
| var_dump($a, $b); | ||
| +[$a, [$b]] = array(new stdclass, array(new stdclass)); | ||
| +var_dump($a, $b); |
|
bwoebi
I've not added many [] tests, it's using the exactly same syntax (array_pair_list) in parser and the differences are abstracted away inside AST.
nikic
You've added eight or so new error conditions and only one of them is currently covered. I'm asking about
TazeTSchnitzel
Oh, yeah, |
|
Just wondering, have you thought of this weird edge case? $a = "a";
$b = "b";
[$foo, $bar] = [$baz, $bat] = [$a, $b];It's pretty ambigious - kind of hard to even assess what that means or what that would do. I don't know if there's a real use case where this would ever matter - I just thought of it so figured I'd bring it up in case there's a missing edge test-case or something. |
|
Well, good, but a test-case to prove that fact probably wouldn't hurt? :-) |
|
can this be closed? @bwoebi |
See: https://wiki.php.net/rfc/short_list_syntax