Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Creating a reflection class of AbstractConsoleController results in a wrong number of @param annotations beeing parsed #21

Open
ThePatta opened this issue Oct 13, 2017 · 1 comment

Comments

@ThePatta
Copy link

Trying to call \Zend\Server\Reflection::reflectClass for a class that extends \Zend\Mvc\Console\Controller\AbstractConsoleController seems to always result in the following exception:

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 seems to be because of the @inheritdoc of \Zend\Mvc\Console\Controller\AbstractConsoleController::dispatch and the dispatch functions of the parent classes. The resulting comment that is parsed looks like this:

/**
     * {@inheritdoc}
     

     * {@inheritdoc}
     

     * Dispatch a request
     *
     * @events dispatch.pre, dispatch.post
     * @param  Request $request
     * @param  null|Response $response
     * @return Response|mixed
     

     * Dispatch a request
     *
     * @param RequestInterface $request
     * @param null|ResponseInterface $response
     * @return Response|mixed
     */

There are 4 @param annotations in this text, and all 4 get parsed (see vendor/zendframework/zend-server/src/Reflection/AbstractFunction.php:284) while the actual function only has 2 parameters, resulting in the above mentioned exception.

The docblock comment seems to come from \Zend\Stdlib\DispatchableInterface::dispatch and \Zend\Mvc\Controller\AbstractController::dispatch, but I think the problem is not the Docblock itself but instead the way it is parsed. If more information is necessary, feel free to ask, I can reproduce the error without a problem.

@michalbundyra
Copy link
Member

This repository has been closed and moved to laminas/laminas-server; a new issue has been opened at laminas/laminas-server#2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants