Annotation of embedaddon/php/Zend/tests/closure_027.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Closure 027: Testing Closure type-hint
! 3: --FILE--
! 4: <?php
! 5:
! 6: function test(closure $a) {
! 7: var_dump($a());
! 8: }
! 9:
! 10:
! 11: test(function() { return new stdclass; });
! 12:
! 13: test(function() { });
! 14:
! 15: $a = function($x) use ($y) {};
! 16: test($a);
! 17:
! 18: test(new stdclass);
! 19:
! 20: ?>
! 21: --EXPECTF--
! 22: object(stdClass)#%d (0) {
! 23: }
! 24: NULL
! 25:
! 26: Notice: Undefined variable: y in %s on line %d
! 27:
! 28: Warning: Missing argument 1 for {closure}(), called in %s on line %d and defined in %s on line %d
! 29: NULL
! 30:
! 31: 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
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>