1--TEST-- 2Closure 027: Testing Closure type-hint 3--FILE-- 4<?php 5 6function test(closure $a) { 7 var_dump($a()); 8} 9 10 11test(function() { return new stdclass; }); 12 13test(function() { }); 14 15$a = function($x) use ($y) {}; 16test($a); 17 18test(new stdclass); 19 20?> 21--EXPECTF-- 22object(stdClass)#%d (0) { 23} 24NULL 25 26Notice: Undefined variable: y in %s on line %d 27 28Warning: Missing argument 1 for {closure}(), called in %s on line %d and defined in %s on line %d 29NULL 30 31Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s:%d 32Stack trace: 33#0 %s(%d): test(Object(stdClass)) 34#1 {main} 35 thrown in %s on line %d 36