public function visitFunction(PhpFunction $function)
 {
     if ($namespace = $function->getNamespace()) {
         $this->writer->write("namespace {$namespace};\n\n");
     }
     $this->writer->write("function {$function->getName()}(");
     $this->writeParameters($function->getParameters());
     $this->writer->write(")\n{\n")->indent()->writeln($function->getBody())->outdent()->rtrim()->write('}');
 }
Beispiel #2
0
 public function visitFunction(PhpFunction $function)
 {
     if ($namespace = $function->getNamespace()) {
         $this->writer->write("namespace {$namespace};\n\n");
     }
     if ($docblock = $function->getDocblock()) {
         $this->writer->writeln($docblock)->rtrim();
     }
     $this->writer->write("function {$function->getName()}(");
     $this->writeParameters($function->getParameters());
     $this->writer->write(')');
     if ($function->hasReturnType()) {
         $type = $function->getReturnType();
         $this->writer->write(': ');
         if (!$function->hasBuiltinReturnType() && '\\' !== $type[0]) {
             $this->writer->write('\\');
         }
         $this->writer->write($type);
     }
     $this->writer->write("\n{\n")->indent()->writeln($function->getBody())->outdent()->rtrim()->write('}');
 }