php-curl-class icon indicating copy to clipboard operation
php-curl-class copied to clipboard

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

Open nottellyou opened this issue 11 months ago • 2 comments

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 avatar Mar 16 '24 02:03 nottellyou

去掉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

nottellyou avatar Mar 16 '24 02:03 nottellyou

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

jshensh avatar Mar 16 '24 02:03 jshensh