swoft-cloud / swoft

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

不支持多个函数返回值类型的解析 #349

Closed adotpeng closed 6 years ago

adotpeng commented 6 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 1.1.0
Swoole version 3.0.0
PHP version 7.2.5
Runtime environment CentOS 7

Details

Describe what you are trying to achieve and what goes wrong.

class ConfigDao {

    /**
     * @param string $name
     * @return null|string
     */
    public function getValueByName( string $name ): ?string {}
}

Provide minimal script to reproduce the issue

Return value of ConfigDao_5b7a96772d198::getValueByName() must be of the type string, null returned
huangzhhui commented 6 years ago

PHP7语法问题

adotpeng commented 6 years ago

@huangzhhui 我测试了下,eval 是支持解析 ?string 这种返回值类型的,在 swoft 中就不行了。

huangzhhui commented 6 years ago

你的问题是什么?你描述清楚一点

adotpeng commented 6 years ago

@huangzhhui swoft 没解析 ?string

swoft 里用的是 eval,而 eval 是能解析函数定义中的 ?string 语法的。