Issues

ZF-10583: Unhelpful exception message thrown when docblock params do not match actual function params

Description

When implementing a server (in our case using Zend_AMF), if the number of parameters listed in the docblock (@param) of your class methods do not match the number of parameters in the actual function definition, then the following exception is thrown:

bq. Variable number of arguments is not supported for services (except optional parameters). Number of function arguments must correspond to actual number of arguments described in a docblock.

This exception is thrown from line 340 (revision 23180) of library/Zend/Server/Reflection/Function/Abstract.php.

In short, it took me quite a while to find the actual offending class and method that was generating this exception. This is because the exception message is unhelpful. I have created a patch to make this a more helpful message. I'm attaching the patch to this issue.

Comments

The attached patch will change the exception message to read:

bq. Variable number of arguments is not supported for services (except optional parameters). Number of function arguments in AMF_Foo::barMethod() must correspond to actual number of arguments described in the docblock.

Fixed in r23182 in trunk & r23183 in release 1.11 branch. Thanks!

Hi Ralph. I'm wondering your fix. http://framework.zend.com/code/diff.php/…


$function->getDeclaringClass()->getName()

"getDeclaringClass" is available at ReflectionFunction?