示例#1
0
 protected function prepareAnnotations(DocBlock $block)
 {
     if (!$block->hasDescription()) {
         $block->setInline(true);
     }
     if ($block->hasAnnotations()) {
         $block->unshiftAnnotation(null);
     }
     $block->unshiftAnnotation('var', $this->type);
 }
示例#2
0
    /** @test */
    public function itShouldOverrideInlineIfDiscriptionOrAnnotations()
    {
        $expected = <<<PHP
/**
 * @foo foo
 * @bar bar
 */
PHP;
        $doc = new DocBlock();
        $doc->setAnnotations([['foo', 'foo'], ['bar', 'bar']]);
        $doc->setInline(true);
        $this->assertSame($expected, $doc->generate());
        $expected = <<<PHP
/**
 * FooBar
 *
 * @bar bar
 */
PHP;
        $doc = new DocBlock();
        $doc->setDescription('FooBar');
        $doc->setAnnotations([['bar', 'bar']]);
        $doc->setInline(true);
        $this->assertSame($expected, $doc->generate());
    }