浏览代码

Fix foreach loop

Guillermo Espinoza 7 年之前
父节点
当前提交
319d9cef05
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Form/ChoiceList/Loader/ClientChoiceLoader.php

+ 3 - 2
Form/ChoiceList/Loader/ClientChoiceLoader.php

@@ -178,14 +178,15 @@ class ClientChoiceLoader implements ChoiceLoaderInterface
         $choices = $this->webservice->getChoices($this->webserviceParameter, $params);
 
         $result = [];
-        $cnt = 0;
+        $cnt = 1;
         $limit = 10;
         $filter = mb_strtolower($filter);
         $filter_len = mb_strlen($filter);
 
         foreach ($choices as $label => $id) {
             $result[$label] = $id;
-            if (++$cnt >= $limit) {
+            $cnt++;
+            if ($cnt == $limit) {
                 break;
             }
         }