mirror of
https://github.com/php/php-src.git
synced 2025-01-08 03:54:29 +08:00
110e0a5a2c
# Conflicts: # Zend/zend_language_scanner.c # Zend/zend_language_scanner.l # ext/simplexml/tests/SimpleXMLElement_xpath.phpt
36 lines
693 B
PHP
36 lines
693 B
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
|
|
|
|
Fatal 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
|
|
Stack trace:
|
|
#0 %s(%d): test(Object(stdClass))
|
|
#1 {main}
|
|
thrown in %s on line %d
|