diff options
Diffstat (limited to 'Zend/tests/closure_027.phpt')
-rw-r--r-- | Zend/tests/closure_027.phpt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Zend/tests/closure_027.phpt b/Zend/tests/closure_027.phpt new file mode 100644 index 0000000..f26e114 --- /dev/null +++ b/Zend/tests/closure_027.phpt @@ -0,0 +1,31 @@ +--TEST-- +Closure 027: Testing Closure type-hint +--FILE-- +<?php + +function test(closure $a) { + var_dump($a()); +} + + +test(function() { return new stdclass; }); + +test(function() { }); + +$a = function($x) use ($y) {}; +test($a); + +test(new stdclass); + +?> +--EXPECTF-- +object(stdClass)#%d (0) { +} +NULL + +Notice: Undefined variable: y in %s on line %d + +Warning: Missing argument 1 for {closure}(), called in %s on line %d and defined in %s on line %d +NULL + +Catchable fatal error: 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 on line %d |