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

发布于 2024-10-06 18:53:33 字数 999 浏览 8 评论 0原文

我尝试了以下操作,

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

I tried the following,

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

But, when I tried to use it in another place, it says PHPDoc not found.

alt text

Any Ideas on how to get this to work in NetBeans PHP?

UPDATE :

The following is the updated syntax which will work in 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) {

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

黑寡妇 2024-10-13 18:53:33

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

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

You are missing an asterisk * in the first line: 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
 */
空心↖ 2024-10-13 18:53:33

附加提示:
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;
}

Additional hint :
Netbeans can make it for you :

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

Now write :

/**[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;
}
乞讨 2024-10-13 18:53:33

您需要在注释上加上 2 ** 才能让 Netbeans 识别它:

不应该

/**         
 *           
 */

只是常规注释

/*
 *
 */

示例:

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

Netbeans 自动添加函数名称

@return 是可选的,但很有用

You need 2 ** on the comments opening for Netbeans to recognize it:

Should be

/**         
 *           
 */

not just a regular comment

/*
 *
 */

Example:

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

Netbeans automatically adds the function name

@return is optional but usefull

纵性 2024-10-13 18:53:33

我相信开始您的功能评论的方法是

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

I believe the way to start you function comment is

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

Note the double asterisk to start your comment.
You might want to check this php documentor.

注定孤独终老 2024-10-13 18:53:33
/**
 *
 * 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.
 */

你可以添加从哪个版本,什么包,什么子包,添加参数类型,即string,mixed,bool,以及返回什么。

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

You may add since which version, what package, what subpackage, add type of parameters, i.e. string, mixed, bool, and what is the return.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文