1--TEST--
2Type inference 023: FETCH_DIM_W
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7--FILE--
8<?php
9function foo($data): array {
10    $a = [];
11    $n = -1;
12    foreach ($data as $d) {
13       if ($n >= 0) {
14            $a[$n]->x = 2;
15       }
16       $n++;
17       $a[$n] = new stdClass();
18       $a[$n]->x = 1;
19	}
20}
21?>
22DONE
23--EXPECT--
24DONE
25