php-src/ext/reflection/tests/ReflectionObject_constructor_error.phpt
Gabriel Caruso ce1d69a1f6 Use int instead of integer in type errors
PHP requires integer typehints to be written "int" and does not
allow "integer" as an alias. This changes type error messages to
match the actual type name and avoids confusing messages like
"must be of the type integer, integer given".
2018-02-04 19:08:23 +01:00

49 lines
1.3 KiB
PHP

--TEST--
ReflectionObject::__construct - invalid arguments
--FILE--
<?php
var_dump(new ReflectionObject());
var_dump(new ReflectionObject('stdClass'));
$myInstance = new stdClass;
var_dump(new ReflectionObject($myInstance, $myInstance));
var_dump(new ReflectionObject(0));
var_dump(new ReflectionObject(null));
var_dump(new ReflectionObject(array(1,2)));
?>
--EXPECTF--
Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 3
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}
Warning: ReflectionObject::__construct() expects parameter 1 to be object, string given in %s on line 4
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}
Warning: ReflectionObject::__construct() expects exactly 1 parameter, 2 given in %s on line 6
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}
Warning: ReflectionObject::__construct() expects parameter 1 to be object, int given in %s on line 7
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}
Warning: ReflectionObject::__construct() expects parameter 1 to be object, null given in %s on line 8
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}
Warning: ReflectionObject::__construct() expects parameter 1 to be object, array given in %s on line 9
object(ReflectionObject)#%d (1) {
["name"]=>
string(0) ""
}