/** @test */ public function itShouldWriteFullBlock() { $expected = <<<PHP /** * Foo * * Bar * Baz * * @name foo * @param string \$bar * * @return string|null description */ PHP; $doc = new DocBlock(); $doc->setDescription('Foo'); $doc->setLongDescription("Bar\nBaz"); $doc->addAnnotation('name', 'foo'); $doc->addParam('string', 'bar'); $doc->setReturn('string|null', 'description'); $this->assertSame($expected, $doc->generate()); }
/** * addParam * * @param string $type * @param string $var * @param string $desc * * @return void */ public function addParam($type, $var, $desc = null) { $this->docBlock->addParam($type, $var, $desc); }
/** * {@inheritdoc} */ protected function prepareAnnotations(DocBlock $block) { if (!$block->hasDescription()) { $block->setDescription($this->name); } foreach ($this->arguments as $argument) { $block->addParam($argument->getType(), $argument->getName()); } if ('__construct' !== $this->name) { $block->setReturn($this->type); } }