Skip to content

兄弟,在PHP5.6下,为啥报错呢?Parse error: syntax error, unexpected '$this' #5

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

Open
nottellyou opened this issue Mar 16, 2024 · 2 comments

Comments

@nottellyou
Copy link

Parse error: syntax error, unexpected '$this' (T_VARIABLE) in F:\0000000000000\php\curl\vendor\jshensh\php-curl-class\src\Multi.php on line 38:

    private function getChGenerator()
    {
        yield from $this->clientArr;   //这一句在php5.6.27下有问题吗?看不出来
    }

如何解决呢?

@nottellyou
Copy link
Author

去掉38行的from,又报错:
Fatal error: Generators cannot return values using "return" in F:\0000000000000\php\curl\vendor\jshensh\php-curl-class\src\Multi.php on line 156

@jshensh
Copy link
Owner

jshensh commented Mar 16, 2024

Parse error: syntax error, unexpected '$this' (T_VARIABLE) in F:\0000000000000\php\curl\vendor\jshensh\php-curl-class\src\Multi.php on line 38:

    private function getChGenerator()
    {
        yield from $this->clientArr;   //这一句在php5.6.27下有问题吗?看不出来
    }

如何解决呢?

我晚一些搭个 5.6 环境测试一下,理论上 foreach$this->clientArr 然后再 yield 就可以了,应该是 5.6 对 yield from 支持有些问题

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