2016-06-21 67 views
1

在Symfony we can use PHPDoc註釋中,我想知道如何通過Symfony項目在PHPDoc塊中引用教程。Symfony3:添加PHPDoc @tutorial標記

the PHPDoc documentation example,我們看到,他們引用此文件phpDocumentor/phpDocumentor.pkg

/** 
* Text with a normal @tutorial tag 
* @tutorial phpDocumentor/phpDocumentor.pkg 
*/ 
function element() 
{ 
} 

但如何,我應該放在哪裏Symfony的項目裏面那些文件?

我們也應該知道在Symfony中使用@package和@subpackage註釋are not

更新

我想使用教程標籤貼在如何使用該方法的一些例子:教程標籤導入「鏈接」文件的內容爲描述生成的PHPDoc的時候。我的問題是如何鏈接到Symfony中的此文件或放在哪裏,在Symfony項目的哪個文件夾中。

回答

0

Symfony像任何PHP框架一樣工作,因此其代碼通過PHPDoc記錄,您在文檔鏈接中指出的更多是Symfony在使用PHPDoc時所做的「例外」。

在PHPDoc中,您可以使用@link註釋引用外部鏈接,將其添加到類的doc塊中,任何documentable element的方法。

例子:

<?php 

/** 
* Foo class. 
* 
* @see \ChildFoo 
* 
* @link http://helpful_related_resource.com/Foo 
*/ 
class Foo 
{ 
    /** 
    * @var Bar 
    * 
    * @link http://helpful_related_resource.com/Foo#$bar 
    */ 
    private $bar; 

    /** 
    * Bar method. 
    * 
    * @link http://helpful_related_resource.com/Foo#getBar() Helpful resource 
    * @link http://helpful_related_resource.com/BarFactory Another helpful resource 
    * 
    * @return Bar 
    */ 
    public function getBar() 
    { 
     /** 
     * @link http://helpful_related_resource.com/Baz 
     */ 
     $baz = new Baz(); 
     $this->bar->addBaz($baz); 

     return $this->bar; 
    } 
} 
+0

此外,你給出的鏈接是關於有助於Symfony的代碼(即是IMO很好的瞭解,並在項目中使用),不是說你應該在你的項目中做什麼,你的代碼文檔是您自己的責任。 – chalasr

+0

鏈接標記標記與教程標記不同;他們都服務於不同的事情。我想使用教程標籤粘貼一些關於如何使用該方法的示例:教程標籤在生成phpDoc時將「鏈接」文件的內容導入到描述中。我的問題是如何鏈接到Symfony中的此文件或放在哪裏,在Symfony項目的哪個文件夾中。 – numediaweb