jshensh / php-curl-class

Custom Curl
GNU General Public License v3.0
51 stars 17 forks source link

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

Open nottellyou opened 8 months ago

nottellyou commented 8 months ago

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 commented 8 months ago

去掉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 commented 8 months ago

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 支持有些问题