2016-06-21 94 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