1--TEST-- 2ReflectionMethod:invokeArgs() 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 13abstract class AbstractClass { 14 abstract function foo(); 15} 16 17$methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs'); 18 19$testClassInstance = new TestClass(); 20 21echo "\nMethod with args:\n"; 22var_dump($methodWithArgs->invokeArgs($testClassInstance, array())); 23 24?> 25--EXPECTF-- 26Method with args: 27 28Fatal error: Uncaught ArgumentCountError: Too few arguments to function TestClass::methodWithArgs(), 0 passed and exactly 2 expected in %sReflectionMethod_invokeArgs_error1.php:5 29Stack trace: 30#0 [internal function]: TestClass->methodWithArgs() 31#1 %sReflectionMethod_invokeArgs_error1.php(19): ReflectionMethod->invokeArgs(Object(TestClass), Array) 32#2 {main} 33 thrown in %sReflectionMethod_invokeArgs_error1.php on line 5 34