1--TEST-- 2Array unpacking with classes 3--FILE-- 4<?php 5 6class C { 7 public const FOO = [0, ...self::ARR, 4]; 8 public const ARR = [1, 2, 3]; 9 public static $bar = [...self::ARR]; 10} 11 12class D { 13 public const A = [...self::B]; 14 public const B = [...self::A]; 15} 16 17var_dump(C::FOO); 18var_dump(C::$bar); 19 20try { 21 var_dump(D::A); 22} catch (Error $ex) { 23 echo "Exception: " . $ex->getMessage() . "\n"; 24} 25?> 26--EXPECT-- 27array(5) { 28 [0]=> 29 int(0) 30 [1]=> 31 int(1) 32 [2]=> 33 int(2) 34 [3]=> 35 int(3) 36 [4]=> 37 int(4) 38} 39array(3) { 40 [0]=> 41 int(1) 42 [1]=> 43 int(2) 44 [2]=> 45 int(3) 46} 47Exception: Cannot declare self-referencing constant self::B 48