My question is pretty much like this one: PHP: Get argument count
Except that I need to count the parameters (arguments if you prefer) of a method, but this method is inside a object.
I tried this:
$reflection = new ReflectionFunction($_SITE,$acao);
$qtdArgumentos = $reflection->getNumberOfParameters();
and this :
$reflection = new ReflectionFunction($_SITE->$acao);
$qtdArgumentos = $reflection->getNumberOfParameters();
and got this error:
Fatal error: Uncaught exception ‘ReflectionException’ with message ‘Function $_SITE,$acao() does not exist’ in C:\wamp\www\project\index.php:20
Stack trace:
#0 C:\wamp\www\project\index.php(20): ReflectionFunction->__construct(‘$_SITE,$acao’)
#1 {main} thrown in C:\wamp\www\projeto\index.php on line 20
Does anyone knows another way to count the number of arguments of a method is inside a object or a workaround for my code?
I think what you need is ReflectionMethod