如何在Netbeans PHP中为我的函数添加文档?
我试了以下方法如何在Netbeans PHP中为我的函数添加文档?,php,netbeans,documentation-generation,code-completion,Php,Netbeans,Documentation Generation,Code Completion,我试了以下方法 /* * addRelationship * * Adds a relationship between two entities using the given relation type. * * @param fromKey the original entity * @param toKey the referring entity * @param relationTypeDesc the type of relationship */ functio
/*
* addRelationship
*
* Adds a relationship between two entities using the given relation type.
*
* @param fromKey the original entity
* @param toKey the referring entity
* @param relationTypeDesc the type of relationship
*/
function addRelationship($fromKey, $toKey, $relationTypeDesc) {
$relationTypeKey = $this->getRelationTypeKey($relationTypeDesc);
但是,当我试图在另一个地方使用它时,它说找不到PHPDoc
关于如何在NetBeans PHP中实现这一点有什么想法吗?
更新:
以下是将在NetBeans PHP中使用的更新语法-
/**
* addRelationship
*
* Adds a relationship between two entities using the given relation type.
*
* @param integer $fromKey the original entity
* @param integet $toKey the referring entity
* @param string $relationTypeDesc the type of relationship
*/
function addRelationship($fromKey, $toKey, $relationTypeDesc) {
第一行中缺少星号
*
:Try
/**
* addRelationship
*
* Adds a relationship between two entities using the given relation type.
*
* @param fromKey the original entity
* @param toKey the referring entity
* @param relationTypeDesc the type of relationship
*/
我相信你开始功能评论的方式是
/**
* addRelationship
*
* Adds a relationship between two entities using the given relation type.
*
* @param fromKey the original entity
* @param toKey the referring entity
* @param relationTypeDesc the type of relationship
*/
请注意双星号以开始您的评论。
您可能需要对此进行检查。要让Netbeans识别它,您需要在打开的注释上添加2**: 应该是
/**
*
*/
不仅仅是一个普通的评论
/*
*
*/
例如:
/**
* function description
*
* @param *vartype* ***param1*** *description*
* @param int param2 this is param two
* @return void
*/
Netbeans会自动添加函数名
@返回是可选的,但很有用
/**
*
* Adds a relationship between two entities using the given relation type.
*
* @since 2.1.1
* @package coreapp
* @subpackage entity
*
* @param string $fromKey the original entity
* @param mixed $toKey the referring entity
* @param string relationTypeDesc the type of relationship
* @return bool False if value was not updated and true if value was updated.
*/
您可以添加哪个版本、哪个包、哪个子包,添加参数类型,即字符串、混合、bool和返回值 附加提示:
Netbeans可以为您提供:
public static function test($var1,$var2) {
return $array;
}
现在写:
/**[press enter]
public static function test($var1,$var2) {
return $array;
}
塔达姆:
/**
*
* @param type $var1
* @param type $var2
* @return type
*/
public static function test($var1,$var2) {
return $array;
}
明白了,谢谢。我对参数名做了一些修改,现在也显示了参数说明。:)对于那些试图获取类的描述的人:键入
newmyclass
时类的描述是从构造函数方法中提取的。因此,用您希望在提示中显示的信息(与类外部相对或附加)记录构造函数。@Pekka웃, 我在netbeans 6.5.1中这样做了,但是对于java方法,当将鼠标放在方法上并单击control时,文档不会出现。有人知道它的快捷方式吗?@MustafaMagdi查看Benjamin Poignant->in netbeans/**[按enter]
的答案,您将自动获得phpdoc(如果该函数存在的话)感谢和+1提示自动生成phpdoc