blob: 5dba208bebc7b719fd08a55790128027031ef396 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
--TEST--
ReflectionMethod::invoke() further errors
--FILE--
<?php
class TestClass {
public function methodWithArgs($a, $b) {
echo "Called methodWithArgs($a, $b)\n";
}
}
$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs');
$testClassInstance = new TestClass();
echo "\nMethod with args:\n";
var_dump($methodWithArgs->invoke($testClassInstance));
?>
--EXPECTF--
Method with args:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function TestClass::methodWithArgs(), 0 passed and exactly 2 expected in %sReflectionMethod_invoke_error2.php:5
Stack trace:
#0 [internal function]: TestClass->methodWithArgs()
#1 %sReflectionMethod_invoke_error2.php(15): ReflectionMethod->invoke(Object(TestClass))
#2 {main}
thrown in %sReflectionMethod_invoke_error2.php on line 5
|