1--TEST-- 2Allow defining Closures passed as constructor arguments in const expressions. 3--FILE-- 4<?php 5 6class Dummy { 7 public function __construct( 8 public Closure $c, 9 ) {} 10} 11 12const Closure = new Dummy(static function () { 13 echo "called", PHP_EOL; 14}); 15 16var_dump(Closure); 17 18(Closure->c)(); 19 20?> 21--EXPECTF-- 22object(Dummy)#%d (1) { 23 ["c"]=> 24 object(Closure)#%d (3) { 25 ["name"]=> 26 string(%d) "{closure:%s:%d}" 27 ["file"]=> 28 string(%d) "%s" 29 ["line"]=> 30 int(9) 31 } 32} 33called 34