32

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) {
Raj
  • 22,346
  • 14
  • 99
  • 142

5 Answers5

40

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
 */
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • got it thanks. I did a little modification to the paramter name the parameter description also is now showing up. :) – Raj Dec 05 '10 at 20:26
  • For those trying to get a description to show up for classes: The description of the class when typing `new myClass` is pulled from the constructor method. So document the constructor with the information (as opposed to or in addition to the outside of the class) you want to show up in the hints. – teynon Apr 23 '13 at 16:51
  • @Pekka 웃, i did that in netbeans 6.5.1 but for java method and when putting the mouse on the method and click control the documentation doesn't appear. – Mahmoud Saleh May 15 '13 at 10:22
  • Does anyone know the shortcut for it? – Mustafa Magdi Apr 04 '16 at 13:37
  • @MustafaMagdi Take a look to the answer from Benjamin Poignant -> in Netbeans `/**[press enter]` and you'll get your phpdoc automaticly (if the function exists) – Silvan Jun 09 '16 at 08:40
21

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;
}
Benjamin Poignant
  • 1,066
  • 8
  • 18
7

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

Paulo
  • 13,937
  • 1
  • 20
  • 10
5

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.

A Salcedo
  • 6,378
  • 8
  • 31
  • 42
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.
 */

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

toha
  • 5,095
  • 4
  • 40
  • 52