Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在yaf中 使用hprose 当 return 字符串时 会产生警告 #59

Closed
pan269 opened this issue Sep 8, 2017 · 4 comments
Closed

在yaf中 使用hprose 当 return 字符串时 会产生警告 #59

pan269 opened this issue Sep 8, 2017 · 4 comments

Comments

@pan269
Copy link

pan269 commented Sep 8, 2017

我注意到是由于 Hprose\Future 中 100行~101行
if (($value !== NULL) and is_object($value) or is_string($value)) {
if (method_exists($value, 'then')) {
导致的
这是一个很棒的设计 但我觉得yaf 中的自动载入也是合理的
能否把 or is_string($value) 去掉

@andot
Copy link
Member

andot commented Sep 10, 2017

$value 可能是类名,所以这里才会有这个判断。

不过好像这个判断确实有些多余,在类中定义一个 then 的静态方法作为一个类 Promise 对象来用,好像并没有什么用。

@pan269
Copy link
Author

pan269 commented Sep 11, 2017

我也注意到了这点
我觉得当 is_string($value) 时可以先用class_exists($value,false)先检查类是否存在然后再检查 method_exists($value, 'then')

说实话 Promise 异步编程这章 我没这么看懂....

@andot
Copy link
Member

andot commented Sep 11, 2017

我把你提交的代码已经合并了。

@andot andot closed this as completed Sep 11, 2017
@pan269
Copy link
Author

pan269 commented Sep 12, 2017

好的 多谢了

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

No branches or pull requests

2 participants