PHP比;语法错误,'$object'(T_VARIABLE)


PHP > syntax error, unexpected '$object' (T_VARIABLE)

在运行PHP 5.3之前得到了一些错误,因此修复了升级到PHP 5.4但没有得到这个错误…什么好主意吗?

错误:

[Thu Aug 11 00:02:27 2016] [error] [client 90.200.49.107] PHP解析错误:语法错误,意外的'$object' (T_VARIABLE)/src/Shopify/Client.php on line 370

LINE 370: yield $object;(从下面的函数)

PHP

public function getResourcePager($resource, $limit = NULL, array $opts = []) {
    $current_page = 1;
    if (!isset($opts['query']['limit'])) {
      $opts['query']['limit'] = ($limit ?: $this->default_limit);
    }
    while (TRUE) {
      $opts['query']['page'] = $current_page;
      $result = $this->get($resource, $opts);
      if (empty($result)) {
        break;
      }
      foreach (get_object_vars($result) as $resource_name => $results) {
        if (empty($results)) {
          return;
        }
        foreach ($results as $object) {
          yield $object;
        }
        if (count($results) < $opts['query']['limit']) {
          // Passing "page" # to Shopify doesn't always implement pagination.
          return;
        }
        $current_page++;
      }
    }
  }

php中的生成器可从php>= 5.5获得