How to add documentation for my functions in Netbeans PHP?
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.
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
*
* Ad开发者_JAVA百科ds 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) {
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
*/
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;
}
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
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.
/**
*
* 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.
精彩评论