File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / closure_027.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>