Sstalle\php7cc\NodeVisitor\ForeachVisitor::checkNestedByReferenceForeach PHP Method

checkNestedByReferenceForeach() protected method

protected checkNestedByReferenceForeach ( PhpParser\Node\Stmt\Foreach_ $foreach )
$foreach PhpParser\Node\Stmt\Foreach_
    protected function checkNestedByReferenceForeach(Node\Stmt\Foreach_ $foreach)
    {
        if (!$foreach->byRef) {
            return;
        }
        /** @var Node\Stmt\Foreach_ $ancestorForeach */
        foreach ($this->getCurrentLoopStack() as $ancestorForeach) {
            if ($ancestorForeach === $foreach) {
                continue;
            }
            if ($ancestorForeach->byRef) {
                $this->addContextMessage('Nested by-reference foreach loop, make sure there is no iteration over the same array', $foreach);
                return;
            }
        }
    }