如何在Netbeans PHP中添加我的函数文档?

时间:2010-12-05 20:12:42

标签: 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
 */

function addRelationship($fromKey, $toKey, $relationTypeDesc) {
    $relationTypeKey = $this->getRelationTypeKey($relationTypeDesc);

但是,当我尝试在其他地方使用它时,它说PHPDoc没有找到。

alt text

关于如何在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) {

5 个答案:

答案 0 :(得分:38)

第一行中缺少星号*:尝试

/**
 * 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
 */

答案 1 :(得分:19)

其他提示: Netbeans可以为你做到:

public static function test($var1,$var2) {
    return $array;
}

现在写:

/**[press enter]
public static function test($var1,$var2) {
    return $array;
}

Tadaam:

/**
 * 
 * @param type $var1
 * @param type $var2
 * @return type
 */
public static function test($var1,$var2) {
    return $array;
}

答案 2 :(得分:6)

在Netbeans的评论开头需要2 **来识别它:

应该是

/**         
 *           
 */

不仅仅是定期评论

/*
 *
 */

示例:

/**
 * function description
 *
 * @param *vartype* ***param1*** *description*
 * @param int param2 this is param two  
 * @return void  
 */

Netbeans会自动添加功能名称

@return是可选的但很有用

答案 3 :(得分:5)

我相信启动你功能评论的方式是

/**
 * 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
 */

请注意双星号以开始发表评论。 您可能需要查看此php documentor

答案 4 :(得分:2)

/**
 *
 * 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,以及返回什么。