public function testReferenceReturned() { $method = new PhpMethod('needsName'); $this->assertFalse($method->isReferenceReturned()); $this->assertSame($method, $method->setReferenceReturned(true)); $this->assertTrue($method->isReferenceReturned()); $this->assertSame($method, $method->setReferenceReturned(false)); $this->assertFalse($method->isReferenceReturned()); }
public function visitMethod(PhpMethod $method) { $this->visitDocblock($method->getDocblock()); 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(")"); $this->writeFunctionReturnType($method->getType()); if ($method->isAbstract() || $method->getParent() instanceof PhpInterface) { $this->writer->write(";\n\n"); return; } $this->writer->writeln(' {')->indent()->writeln(trim($method->getBody()))->outdent()->rtrim()->write("}\n\n"); }