1--TEST-- 2Allow defining Closures wrapped in an array in const expressions. 3--FILE-- 4<?php 5 6const Closure = [static function () { 7 echo "called", PHP_EOL; 8}, static function () { 9 echo "also called", PHP_EOL; 10}]; 11 12var_dump(Closure); 13 14foreach (Closure as $closure) { 15 $closure(); 16} 17 18?> 19--EXPECTF-- 20array(2) { 21 [0]=> 22 object(Closure)#%d (3) { 23 ["name"]=> 24 string(%d) "{closure:%s:%d}" 25 ["file"]=> 26 string(%d) "%s" 27 ["line"]=> 28 int(3) 29 } 30 [1]=> 31 object(Closure)#%d (3) { 32 ["name"]=> 33 string(%d) "{closure:%s:%d}" 34 ["file"]=> 35 string(%d) "%s" 36 ["line"]=> 37 int(5) 38 } 39} 40called 41also called 42