private function collectVars($node, array $vars = array())
    {
        $noFetcher = new NodeFetcher();

        foreach ($noFetcher->foreachNodes($node) as &$stmt) {
            if ($stmt['node'] instanceof Expr\Assign) {
                if (($stmt['node']->var instanceof Expr\PropertyFetch) === false 
                 && ($stmt['node']->var instanceof Expr\StaticPropertyFetch) === false
                 && ($stmt['node']->var instanceof Expr\ArrayDimFetch) === false
                 && ($stmt['node']->var instanceof Expr\List_) === false) {
                    if (is_object($stmt['node']->var->name) === false) { // if true it is a dynamic var
                        $vars[] = $stmt['node']->var->name;
                    }
                } elseif (($stmt['node']->var instanceof Expr\List_) === true) {
                    $varInList = array();
                    foreach ($stmt['node']->var->vars as $var) {
                        if (null !== $var) { 
                            $varInList[] = ucfirst($this->dispatcher->p($var));
                            if (($var instanceof Expr\ArrayDimFetch) === false) {
                                $vars[] = $this->dispatcher->p($var);
                            }
                        }
                    }

                    $vars[] = 'tmpList' . str_replace(array('[', ']', '"'), '', implode('', $varInList));
                }
            } elseif ($stmt['node'] instanceof Stmt\Foreach_) {
                if (null !== $stmt['node']->keyVar) {
                    $vars[] = $stmt['node']->keyVar->name;
                }
                $vars[] = $stmt['node']->valueVar->name;
            } elseif ($stmt['node'] instanceof Stmt\For_) {
                foreach ($stmt['node']->init as $init) {
                    if ($init instanceof Expr\Assign) {
                        $vars[] = $init->var->name;
                    }
                }
            } elseif ($stmt['node'] instanceof Stmt\If_) {
                foreach ($this->nodeFetcher->foreachNodes($stmt['node']->cond) as $nodeData) {
                    $node = $nodeData['node'];
                    if ($node instanceof Expr\Array_) {
                        $vars[] = 'tmpArray'.md5(serialize($node->items));
                    }
                }
            } elseif ($stmt['node'] instanceof Stmt\Catch_) {
                $vars[] = $stmt['node']->var;
            } elseif ($stmt['node'] instanceof Stmt\Return_ && $stmt['node']->expr instanceof Expr\Array_) {
                $vars[] = 'tmpArray'.md5(serialize($stmt['node']->expr->items));
            } elseif ($stmt['node'] instanceof Stmt\Static_) {
            	foreach ($stmt['node']->vars as $var) {
                	$vars[] = $var->name;
            	}
            } elseif ($stmt['node'] instanceof Arg && $stmt['node']->value instanceof Expr\Array_) {
            	 $vars[] = 'tmpArray'.md5(serialize($stmt['node']->value->items));
            }
            
            if ($stmt['node'] instanceof Expr\ArrayDimFetch && !in_array("PhpParser\Node\Expr\ArrayDimFetch", $stmt['parentClass'])) {
                $varCreatedInArray = $this->dispatcher->pExpr_ArrayDimFetch($stmt['node'], true);
                foreach ($varCreatedInArray['vars'] as $var) {
                    $vars[] = $var;
                }
            }
        }

        $vars = array_map(array($this->reservedWordReplacer, 'replace'), $vars);

        return $vars;
    }
private function collectVars($node, array $vars = array())
    {
        $noFetcher = new NodeFetcher();

        foreach ($noFetcher->foreachNodes($node) as &$stmt) {
            if ($stmt['node'] instanceof Expr\Assign) {
                if (($stmt['node']->var instanceof Expr\PropertyFetch) === false 
                 && ($stmt['node']->var instanceof Expr\StaticPropertyFetch) === false
                 && ($stmt['node']->var instanceof Expr\ArrayDimFetch) === false
                 && ($stmt['node']->var instanceof Expr\List_) === false) {
                    if (is_object($stmt['node']->var->name) === false) { // if true it is a dynamic var
                        $vars[] = $stmt['node']->var->name;
                    }
                } elseif (($stmt['node']->var instanceof Expr\List_) === true) {
                    $varInList = array();
                    foreach ($stmt['node']->var->vars as $var) {
                        if (null !== $var) { 
                            $varInList[] = ucfirst($this->dispatcher->p($var));
                            if (($var instanceof Expr\ArrayDimFetch) === false) {
                                $vars[] = $this->dispatcher->p($var);
                            }
                        }
                    }

                    $vars[] = 'tmpList' . str_replace(array('[', ']', '"'), '', implode('', $varInList));
                }
            } elseif ($stmt['node'] instanceof Stmt\Foreach_) {
                if (null !== $stmt['node']->keyVar) {
                    $vars[] = $stmt['node']->keyVar->name;
                }
                $vars[] = $stmt['node']->valueVar->name;
            } elseif ($stmt['node'] instanceof Stmt\For_) {
                foreach ($stmt['node']->init as $init) {
                    if ($init instanceof Expr\Assign) {
                        $vars[] = $init->var->name;
                    }
                }
            } elseif ($stmt['node'] instanceof Stmt\If_) {
                foreach ($this->nodeFetcher->foreachNodes($stmt['node']->cond) as $nodeData) {
                    $node = $nodeData['node'];
                    if ($node instanceof Expr\Array_) {
                        $vars[] = 'tmpArray'.md5(serialize($node->items));
                    }
                }
            } elseif ($stmt['node'] instanceof Stmt\Catch_) {
                $vars[] = $stmt['node']->var;
            } elseif ($stmt['node'] instanceof Stmt\Return_ && $stmt['node']->expr instanceof Expr\Array_) {
                $vars[] = 'tmpArray'.md5(serialize($stmt['node']->expr->items));
            } elseif ($stmt['node'] instanceof Stmt\Static_) {
            	foreach ($stmt['node']->vars as $var) {
                	$vars[] = $var->name;
            	}
            } elseif ($stmt['node'] instanceof Arg && $stmt['node']->value instanceof Expr\Array_) {
            	 $vars[] = 'tmpArray'.md5(serialize($stmt['node']->value->items));
            }
            
            if ($stmt['node'] instanceof Expr\ArrayDimFetch && !in_array("PhpParser\Node\Expr\ArrayDimFetch", $stmt['parentClass'])) {
                $varCreatedInArray = $this->dispatcher->pExpr_ArrayDimFetch($stmt['node'], true);
                foreach ($varCreatedInArray['vars'] as $var) {
                    $vars[] = $var;
                }
            }
        }

        $vars = array_map(array($this->reservedWordReplacer, 'replace'), $vars);

        return $vars;
    }
@param \ArrayIterator|array $node
@param array                $vars

@return \ArrayIterator|array