How to add documentation for my functions in Netbeans PHP?

31,352

Solution 1

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

Solution 2

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;
}

Solution 3

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

Solution 4

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.

Solution 5

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

Share:
31,352
Raj
Author by

Raj

My interests include Web development, Android, Cricket and Personal Computing. Not been very active on StackOverflow recently. My LinkedIn profile:

Updated on July 22, 2022

Comments

  • Raj
    Raj almost 2 years

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