1--TEST--
2list() with keys, evaluation order
3--FILE--
4<?php
5
6require_once "list_keyed_evaluation_order.inc";
7
8$a = new StringCapable("A");
9$c = new StringCapable("C");
10
11$e = new IndexableRetrievable("E", new Indexable(["A" => "value for offset A", "C" => "value for offset C"]));
12
13$store = new Indexable([]);
14
15// list($a => $b, $c => $d) = $e;
16// Should be evaluated in the order:
17// 1. Evaluate $e
18// 2. Evaluate $a
19// 3. Evaluate $e[$a]
20// 4. Assign $b from $e[$a]
21// 5. Evaluate $c
22// 6. Evaluate $e[$c]
23// 7. Assign $c from $e[$a]
24
25list((string)$a => $store["B"], (string)$c => $store["D"]) = $e->getIndexable();
26
27?>
28--EXPECT--
29Indexable E retrieved.
30A evaluated.
31Offset A retrieved.
32Offset B set to value for offset A.
33C evaluated.
34Offset C retrieved.
35Offset D set to value for offset C.
36