mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00

Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to report FAILURE errors using a TypeException instead of a Warning, like it would happen in strict mode. Adds a zend_parse_parameters_throw() convenience function, which invokes zpp with this flag. Converts all cases I could identify, where we currently have throwing zpp usage in constructors and replaces them with this API. Error handling is still replaced to EH_THROW in some cases to handle other, domain-specific errors in constructors.
33 lines
781 B
PHP
33 lines
781 B
PHP
--TEST--
|
|
ReflectionExtension::__construct()
|
|
--CREDITS--
|
|
Gerrit "Remi" te Sligte <remi@wolerized.com>
|
|
Leon Luijkx <leon@phpgg.nl>
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
$obj = new ReflectionExtension();
|
|
} catch (TypeException $re) {
|
|
echo "Ok - ".$re->getMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
$obj = new ReflectionExtension('foo', 'bar');
|
|
} catch (TypeException $re) {
|
|
echo "Ok - ".$re->getMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
$obj = new ReflectionExtension([]);
|
|
} catch (TypeException $re) {
|
|
echo "Ok - ".$re->getMessage().PHP_EOL;
|
|
}
|
|
|
|
|
|
?>
|
|
==DONE==
|
|
--EXPECTF--
|
|
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
|
|
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
|
|
Ok - ReflectionExtension::__construct() expects parameter 1 to be string, array given
|
|
==DONE==
|