PHP>语法错误,意外' $ object' (T_VARIABLE)

时间:2016-08-10 23:11:13

标签: php

在运行PHP 5.3之前遇到了一些错误,因此修复了升级到PHP 5.4但没有收到此错误......有什么想法吗?

ERROR:

  

[Thu Aug 11 00:02:27 2016] [错误] [客户端90.200.49.107] PHP Parse   错误:语法错误,意外' $ object' (T_VARIABLE)in   第370行/src/Shopify/Client.php

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++;
      }
    }
  }

1 个答案:

答案 0 :(得分:0)

php中的

Generators可从php&gt; = 5.5获得。