swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

Swoft\Rpc\Server\Request getParamsMap方法 #1225

Open ChangeChe opened 4 years ago

ChangeChe commented 4 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.7
Swoole version 4.4.16
PHP version 7.2.13
Runtime environment Mac

Describe the bug Swoft\Rpc\Server\Request::getParamsMap方法获取的值都是同一个,都是index=0的值

php code

/**
     * @return array
     * @throws ReflectionException
     */
    public function getParamsMap(): array
    {
        $rc       = BeanFactory::getReflection($this->interface);
        $rxParams = $rc['methods'][$this->method]['params'];

        $index     = 0;
        $paramsMap = [];
        foreach ($rxParams as $methodParams) {
            if (!isset($this->params[$index])) {
                break;
            }

            [$name] = $methodParams;
            $paramsMap[$name] = $this->params[$index];
        }
        return $paramsMap;
    }

从以上代码可以看出, $index一直都是0

inhere commented 4 years ago

@stelin