Symfony3:添加PHPDoc@tutorial标记
在PHPDoc注释的Symfony中,我想知道如何使用Symfony项目在PHPDoc块中引用教程 在中,我们看到他们引用了这个文件Symfony3:添加PHPDoc@tutorial标记,php,annotations,symfony,phpdoc,Php,Annotations,Symfony,Phpdoc,在PHPDoc注释的Symfony中,我想知道如何使用Symfony项目在PHPDoc块中引用教程 在中,我们看到他们引用了这个文件phpDocumentor/phpDocumentor.pkg: /** * Text with a normal @tutorial tag * @tutorial phpDocumentor/phpDocumentor.pkg */ function element() { } 但是我应该如何以及在哪里将这些文件放在我的Symfony项目中呢 我们还应该
phpDocumentor/phpDocumentor.pkg
:
/**
* Text with a normal @tutorial tag
* @tutorial phpDocumentor/phpDocumentor.pkg
*/
function element()
{
}
但是我应该如何以及在哪里将这些文件放在我的Symfony项目中呢
我们还应该知道,Symfony中使用的@package和@subpackage注释
更新
我想使用tutorial标记粘贴一些关于如何使用该方法的示例:tutorial标记在生成phpDoc时将“链接”文件的内容导入到描述中。我的问题是如何在Symfony中链接到这个文件,或者将它放在哪里,在Symfony项目的哪个文件夹中。Symfony与任何PHP框架一样工作,因此它的代码是通过PHPDoc记录的,您在文档链接中指出的更多的是Symfony在使用PHPDoc时所做的“例外” 在PHPDoc中,您可以引用带有注释的外部链接,该注释添加到类的doc块中,可以是任何类型的方法 例如:
<?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;
}
}
Symfony的工作原理与任何PHP框架类似,因此其代码都是通过PHPDoc记录的,您在文档链接中指出的更多是Symfony在使用PHPDoc时的“例外情况” 在PHPDoc中,您可以引用带有注释的外部链接,该注释添加到类的doc块中,可以是任何类型的方法 例如:
<?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;
}
}
此外,您提供的链接是关于对Symfony代码的贡献(这在您的项目中是很好了解和使用的),而不是关于您在项目中应该做什么,您的代码文档由您自己负责。链接标签与教程标签不同;它们都提供不同的服务。我想使用tutorial标记粘贴一些关于如何使用该方法的示例:tutorial标记在生成phpDoc时将“链接”文件的内容导入到描述中。我的问题是如何在Symfony中链接到这个文件,或者将它放在哪里,在Symfony项目的哪个文件夹中。此外,您提供的链接是关于对Symfony代码的贡献(这在您的项目中很好地了解和使用),而不是关于您在项目中应该做什么,代码文档由您自己负责。链接标记与教程标记不同;它们都提供不同的服务。我想使用tutorial标记粘贴一些关于如何使用该方法的示例:tutorial标记在生成phpDoc时将“链接”文件的内容导入到描述中。我的问题是如何在Symfony中链接到这个文件,或者将它放在哪里,在Symfony项目的哪个文件夹中。