break;
default:
- _DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be either a string, an array(class, method) or a callable object, %s given", zend_zval_type_name(reference));
RETURN_THROWS();
}
}
if ((tmp = strstr(name_str, "::")) == NULL) {
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Invalid method name %s", name_str);
+ zend_argument_error(reflection_exception_ptr, 1, "must be a valid method name");
RETURN_THROWS();
}
classname = &ztmp;
if (classname == &ztmp) {
zval_ptr_dtor_str(&ztmp);
}
- _DO_THROW("The parameter class is expected to be either a string or an object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
RETURN_THROWS();
}
break;
default:
- _DO_THROW("The parameter class is expected to be either a string or an object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
RETURN_THROWS();
}
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Parameter one must either be a string or a ReflectionClass object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type ReflectionClass|string, %s given", zend_zval_type_name(class_name));
RETURN_THROWS();
}
}
/* no break */
default:
- zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Parameter one must either be a string or a ReflectionClass object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type ReflectionClass|string, %s given", zend_zval_type_name(interface));
RETURN_THROWS();
}
break;
default:
- _DO_THROW("The parameter class is expected to be either a string or an object");
+ zend_argument_error(reflection_exception_ptr, 1, "must be of type object|string, %s given", zend_zval_type_name(classname));
RETURN_THROWS();
}
} else if (Z_TYPE_P(key) == IS_STRING) {
item = zend_symtable_find(ht, Z_STR_P(key));
} else {
- zend_type_error("Key must be array or string");
+ zend_argument_type_error(2, "must be of type string|int, %s given", zend_zval_type_name(key));
RETURN_THROWS();
}
echo "Done\n";
?>
--EXPECT--
-string(20) "Invalid method name "
-string(21) "Invalid method name 1"
+string(91) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name"
+string(91) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name"
string(21) "Class does not exist"
string(22) "Class a does not exist"
string(21) "Class does not exist"
string(22) "Class a does not exist"
string(21) "Class does not exist"
-string(66) "The parameter class is expected to be either a string or an object"
+string(104) "ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, int given"
string(21) "Class does not exist"
Done
echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Does A implement A?
- Using object argument: A is not an interface
- Using string argument: A is not an interface
Test bad arguments:
ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given
ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::implementsInterface(): Argument #1 ($interface) must be of type ReflectionClass|string, null given
Interface ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::implementsInterface(): Argument #1 ($interface) must be of type ReflectionClass|string, int given
Test bad arguments:
ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, null given
Class ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, int given
?>
--EXPECTF--
Wrong type of argument (bool):
-ReflectionException: Invalid method name 1 in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('1')
#1 {main}
Wrong type of argument (int):
-ReflectionException: Invalid method name 3 in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('3')
#1 {main}
Wrong type of argument (bool, string):
-ReflectionException: The parameter class is expected to be either a string or an object in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, bool given in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct(true, 'foo')
#1 {main}
#0 %s ReflectionMethod->__construct('TestClass', '1')
#1 {main}
No method given:
-ReflectionException: Invalid method name TestClass in %s
+ReflectionException: ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be a valid method name in %s:%d
Stack trace:
#0 %s ReflectionMethod->__construct('TestClass')
#1 {main}
Too many arguments:
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
Ok - Class InvalidClassName does not exist
-Ok - The parameter class is expected to be either a string or an object
+Ok - ReflectionMethod::__construct(): Argument #1 ($class_or_method) must be of type object|string, array given
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 2 given
Test bad arguments:
ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, null given
Class ThisClassDoesNotExist does not exist
-Parameter one must either be a string or a ReflectionClass object
+ReflectionClass::isSubclassOf(): Argument #1 ($class) must be of type ReflectionClass|string, int given
Method C::b() does not exist
Method C::b() does not exist
Ok - ReflectionParameter::__construct() expects exactly 2 parameters, 1 given
-Ok - The parameter class is expected to be either a string, an array(class, method) or a callable object
+Ok - ReflectionParameter::__construct(): Argument #1 ($function) must be either a string, an array(class, method) or a callable object, int given
Done.
Class NonExistentClass does not exist
Wrong property parameter type:
-The parameter class is expected to be either a string or an object
+ReflectionProperty::__construct(): Argument #1 ($class) must be of type object|string, int given
Non-existent property:
Property TestClass::$nonExistentProperty does not exist
--EXPECTF--
Call to private ReflectionReference::__construct() from invalid context
ReflectionReference::fromArrayElement(): Argument #1 ($array) must be of type array, object given
-Key must be array or string
+ReflectionReference::fromArrayElement(): Argument #2 ($key) must be of type string|int, float given
Array key not found
Serialization of 'ReflectionReference' is not allowed