Beispiel #1
0
    /** @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());
    }
Beispiel #2
0
 /**
  * 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);
 }
Beispiel #3
0
 /**
  * {@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);
     }
 }