Run arginfo / zpp mismatch tests for methods as well

As a side-effect, this also catches issues where classes are not
prepared for use with newInstanceWithoutConstructor.
This commit is contained in:
Nikita Popov 2020-07-17 15:50:06 +02:00
parent 38fb1f8383
commit c9881fde7a

View file

@ -3,10 +3,27 @@ Test that there is no arginfo/zpp mismatch
--FILE--
<?php
foreach (get_defined_functions()["internal"] as $function) {
function test($function) {
try {
@$function(null, null, null, null, null, null, null, null);
} catch (ArgumentCountError|Error) {
} catch (Throwable) {
}
}
foreach (get_defined_functions()["internal"] as $function) {
test($function);
}
foreach (get_declared_classes() as $class) {
try {
$rc = new ReflectionClass($class);
$obj = $rc->newInstanceWithoutConstructor();
} catch (Throwable) {
continue;
}
foreach (get_class_methods($class) as $method) {
test([$obj, $method]);
}
}