PHPCfg\Parser::parseExpr_Closure PHP Method

parseExpr_Closure() protected method

protected parseExpr_Closure ( Closure $expr )
$expr PhpParser\Node\Expr\Closure
    protected function parseExpr_Closure(Expr\Closure $expr)
    {
        $uses = [];
        foreach ($expr->uses as $use) {
            $uses[] = new Operand\BoundVariable($this->readVariable(new Literal($use->var)), $use->byRef, Operand\BoundVariable::SCOPE_LOCAL);
        }
        $flags = Func::FLAG_CLOSURE;
        $flags |= $expr->byRef ? Func::FLAG_RETURNS_REF : 0;
        $flags |= $expr->static ? Func::FLAG_STATIC : 0;
        $this->script->functions[] = $func = new Func('{anonymous}#' . ++$this->anonId, $flags, $this->parseExprNode($expr->returnType), null);
        $this->parseFunc($func, $expr->params, $expr->stmts, null);
        $closure = new Op\Expr\Closure($func, $uses, $this->mapAttributes($expr));
        $func->callableOp = $closure;
        return $closure;
    }
Parser