是否有类似于netbean的PHP/phpDocumentor/Eclipse的Javadoc自动评论工具?在netbeans实现中:
弹出一个对话框,允许您运行类的所有成员并输入注释,这些注释将添加到源文件中.它甚至验证没有您没有考虑的参数,因此您可以确定您的评论是完整的.
理想情况下,这将是独立的软件,但插件也可以:)
ps netbeans 6+ 自动评论被移动/重命名.现在在"工具 - >选项"中,选项卡:"Java代码",Javadoc:"提示"
编辑:原始Netbeans工具的screengrab: 替代文字http://www.vsj.co.uk/pix/articleimages/dec03/netbeans8large.jpg
在PHP项目中,即使前端控制器逻辑用于主应用程序,也可以有许多独立脚本,ajax片段等.
是否有标准化的方法 - PHPDoc或其他 - 在脚本的第一个注释块中定义脚本将接受/要求的GET和/或POST参数以及它们的类型?
我通常只是通过添加@params 来帮助自己,好像文件是一个函数,并@return解释脚本的作用和返回,但也许有一种我不知道的更专业的方式.
是否有标准方法在Doctrine项目的docblock注释中记录Collection内的预期实体类?就像是:
/**
* @var Collection<User>
*/
protected $users;
Run Code Online (Sandbox Code Playgroud)
看起来PHPDoc现在是docblock注释的事实标准,但是我找不到这个用例的任何提及.
有没有办法使用命令或组合键在VIM中插入PHPDoc?
例如,我有一个班级:
class MyClass
{
public function __construct() { }
public function __destruct() { }
/* command here to insert PHP doc */
public function abc() { }
}
Run Code Online (Sandbox Code Playgroud)
我想插入类似的东西:
/**
* method()
*
* description
*
* @access
* @author
* @param type $varname description
* @return type description
* @copyright
* @version
*/
Run Code Online (Sandbox Code Playgroud)
然后我可以手动完成剩下的工作.谢谢
是否有一个PHPCS编码标准,将检查适当的注释(@param,@return,@throws等)存在于文档块,包括它们之间的适当的间距?
大多数PHP IDE依靠phpdoc来获取有关表达式类型的提示.然而,我经常使用这种模式,似乎没有涵盖:
class Control {
private $label = '';
/** @return ??? */
public static function Make(){ return new static(); }
/** @return ??? */
public function WithLabel($value){ $this->label = $value; return $this; }
/** @return void */
public function Render(){ /* ... */ }
}
class Textbox extends Control {
private $text = '';
/** @return ??? */
public function WithText($text){ $this->width = $text; return $this; }
}
Run Code Online (Sandbox Code Playgroud)
现在我可以使用这样的类:
Textbox::Make() // <-- late static binding, returns Textbox
->WithLabel('foo') // …Run Code Online (Sandbox Code Playgroud) 我正在运行phpdoc我的项目,并且有一个文件(唯一有意义的文件),其中方法的顺序对于分组方法很重要.如何在生成的文档中使用与源文件中相同的函数顺序?
实际上,如果有帮助,我准备改变doc框架.
我需要为PhpDocumentor创建自定义模板.问题是template.xml,即使指定为绝对路径中定义的路径也未正确解析.PhpDocumentor在供应商目录中查找它们.
<template>
<author>Code Mine</author>
<email>office@code-mine.com</email>
<description>Template for Confluence API</description>
<version>1.0.0</version>
<transformations>
<transformation writer="twig" source="./index.html.twig" artifact="index.html"/>
<transformation query="indexes.namespaces" writer="twig" source="./namespace.html.twig" />
<transformation query="indexes.classes" writer="twig" source="./class.html.twig" />
</transformations>
</template>
Run Code Online (Sandbox Code Playgroud)
尽管twig模板位于xml引用的路径中,但我收到文件不存在的错误.
编辑:
我还尝试设置所有配置细节,phpdoc.xml希望路径将被视为相对于配置文件,但没有运气.
在PHP7中,当方法设置给定的参数类型和结果类型时,是否有必要在PHPDoc中再次记录它们?
以来
function foo(string $text): bool
{
return true;
}
Run Code Online (Sandbox Code Playgroud)
相当于
/**
* @param string $text
* @return bool
*/
function foo($text) {
return true;
}
Run Code Online (Sandbox Code Playgroud)
是否有必要复制这些信息?
/**
* @param string $text
* @return bool
*/
function foo(string $text): bool
{
return true;
}
Run Code Online (Sandbox Code Playgroud)
编辑:我不使用PHPDoc生成我的代码文档,而是在PHPStorm的帮助下为我和我的同事保持方法的一致性.
如何在编写教程/扩展文档时使用phpDocumentor编写代码块?
我试过<programlisting>,它可以生成<code>标记,但它不解析其内容.
<refentry id="{@id}">
<refnamediv>
<refname>Guide for MyApp</refname>
<refpurpose>To demonstrate ...</refpurpose>
</refnamediv>
<refsynopsisdiv>
<author>
My Name
<authorblurb>
{@link mail@mail.com My Name}
</authorblurb>
</author>
</refsynopsisdiv>
{@toc}
<refsect1 id="{@id intro}">
<title>User Guide for MyApp</title>
<para>
Some Description
</para>
<programlisting>
$some = 'code';
</programlisting>
</refsect1>
</refentry>
Run Code Online (Sandbox Code Playgroud) phpdoc ×10
php ×9
codesniffer ×1
docblocks ×1
doctrine ×1
doctrine-orm ×1
doxygen ×1
external ×1
javadoc ×1
late-binding ×1
netbeans ×1
php-7 ×1
php-ide ×1
twig ×1
vim ×1