1--TEST-- 2Test static typed properties with references 3--FILE-- 4<?php 5 6class A { 7 static iterable $it = []; 8 static ?array $a; 9} 10 11A::$a = &A::$it; 12 13try { 14 A::$it = new ArrayIterator(); 15} catch (TypeError $e) { var_dump($e->getMessage()); } 16var_dump(A::$it); 17 18A::$a = &$a; 19 20A::$it = new ArrayIterator(); 21 22try { 23 $a = 1; 24} catch (TypeError $e) { var_dump($e->getMessage()); } 25var_dump($a); 26 27?> 28--EXPECT-- 29string(78) "Cannot assign ArrayIterator to reference held by property A::$a of type ?array" 30array(0) { 31} 32string(68) "Cannot assign int to reference held by property A::$a of type ?array" 33NULL 34