PHPCompiler\Backend\PHP7\PHP::compileFunction PHP Method

compileFunction() protected method

protected compileFunction ( Function_ $func )
$func PHPCfg\Op\Stmt\Function_
    protected function compileFunction(Op\Stmt\Function_ $func)
    {
        $signature = 'function ' . ($func->byRef ? '&' : '') . $func->name->value . '(';
        $sep = '';
        foreach ($func->params as $param) {
            $signature .= $sep;
            $sep = ', ';
            $signature .= $param->result->type;
            $signature .= $param->byRef ? ' &' : ' ';
            $signature .= $this->getVarName($param->result);
        }
        $signature .= ') : ' . $func->returnType->value;
        $code = $this->compileBody($func->stmts, '    ');
        $this->state->functions[] = $signature . " {\n" . $code . "\n}";
    }