public function visitMethod(PhpMethod $method) { if ($docblock = $method->getDocblock()) { $this->writer->writeln($docblock)->rtrim(); } if ($method->isAbstract()) { $this->writer->write('abstract '); } $this->writer->write($method->getVisibility() . ' '); if ($method->isStatic()) { $this->writer->write('static '); } $this->writer->write('function ' . $method->getName() . '('); $this->writeParameters($method->getParameters()); if ($method->isAbstract()) { $this->writer->write(");\n\n"); return; } $this->writer->writeln(")")->writeln('{')->indent()->writeln($method->getBody())->outdent()->rtrim()->write("}\n\n"); }
public function visitMethod(PhpMethod $method) { if ($docblock = $method->getDocblock()) { $this->writer->writeln($docblock)->rtrim(); } if ($method->isAbstract()) { $this->writer->write('abstract '); } $this->writer->write($method->getVisibility() . ' '); if ($method->isStatic()) { $this->writer->write('static '); } $this->writer->write('function '); if ($method->isReferenceReturned()) { $this->writer->write('& '); } $this->writer->write($method->getName() . '('); $this->writeParameters($method->getParameters()); $this->writer->write(")"); if ($method->hasReturnType()) { $type = $method->getReturnType(); $this->writer->write(': '); if (!$method->hasBuiltInReturnType() && '\\' !== $type[0]) { $this->writer->write('\\'); } $this->writer->write($type); } if ($method->isAbstract() || $this->isInterface) { $this->writer->write(";\n\n"); return; } $this->writer->writeln("\n{")->indent()->writeln($method->getBody())->outdent()->rtrim()->write("}\n\n"); }