Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.
This repository was 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

@ThePatta

Description

@ThePatta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions