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