src/PhpToZephir/Converter/Printer/Stmt/ForPrinter.php
public function convert(Stmt\For_ $node)
    {
        if (is_array($node->cond) && count($node->cond) > 1) {
            throw new \Exception(sprintf('Cannot convert %s ', $this->dispatcher->pCommaSeparated($node->cond)));
        }

        if (count($node->cond) === 0) {
            return (!empty($node->init) ? $this->dispatcher->pStmts($node->init)."\n" : '')
               .'loop'
              ." {\n".$this->dispatcher->pStmts($node->stmts)."\n".$this->dispatcher->pStmts($node->loop)."\n".'}';
        } elseif ($node->cond[0] instanceof BinaryOp) {
            $node = $this->findIteratorVar($node);

            return $this->printVars($node) . 'for '
                 .$this->dispatcher->p($node->init[0]->var).' in '.(!empty($node->cond) ? '' : '')
                 .'range('.$this->dispatcher->p($node->cond[0]->left).', '.$this->dispatcher->p($node->cond[0]->right).')'
                 .' {'.$this->dispatcher->pStmts($node->stmts)."\n".'}';
        } elseif (count($node->cond) === 1 && $node->cond[0] instanceof Node\Expr) {
            $ifNode = new Stmt\If_($node->cond[0], array('stmts' => array(new Node\Stmt\Break_())));
            return (!empty($node->init) ? $this->dispatcher->pStmts($node->init)."\n" : '')
            .'loop'
                    ." {\n".$this->dispatcher->p($ifNode)."\n".$this->dispatcher->pStmts($node->stmts)."\n".$this->dispatcher->pStmts($node->loop)."\n".'}';
        } else {
            throw new \Exception(sprintf('Cannot convert %s ', $this->dispatcher->pCommaSeparated($node->cond)));
        }
    }
public function convert(Stmt\For_ $node)
    {
        if (is_array($node->cond) && count($node->cond) > 1) {
            throw new \Exception(sprintf('Cannot convert %s ', $this->dispatcher->pCommaSeparated($node->cond)));
        }

        if (count($node->cond) === 0) {
            return (!empty($node->init) ? $this->dispatcher->pStmts($node->init)."\n" : '')
               .'loop'
              ." {\n".$this->dispatcher->pStmts($node->stmts)."\n".$this->dispatcher->pStmts($node->loop)."\n".'}';
        } elseif ($node->cond[0] instanceof BinaryOp) {
            $node = $this->findIteratorVar($node);

            return $this->printVars($node) . 'for '
                 .$this->dispatcher->p($node->init[0]->var).' in '.(!empty($node->cond) ? '' : '')
                 .'range('.$this->dispatcher->p($node->cond[0]->left).', '.$this->dispatcher->p($node->cond[0]->right).')'
                 .' {'.$this->dispatcher->pStmts($node->stmts)."\n".'}';
        } elseif (count($node->cond) === 1 && $node->cond[0] instanceof Node\Expr) {
            $ifNode = new Stmt\If_($node->cond[0], array('stmts' => array(new Node\Stmt\Break_())));
            return (!empty($node->init) ? $this->dispatcher->pStmts($node->init)."\n" : '')
            .'loop'
                    ." {\n".$this->dispatcher->p($ifNode)."\n".$this->dispatcher->pStmts($node->stmts)."\n".$this->dispatcher->pStmts($node->loop)."\n".'}';
        } else {
            throw new \Exception(sprintf('Cannot convert %s ', $this->dispatcher->pCommaSeparated($node->cond)));
        }
    }
@param Stmt\For_ $node

@return string