Как добавить документацию для моих функций в Netbeans PHP?
Я попробовал следующее:
/*
* 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]()
Любые идеи о том, как заставить это работать в PHP NetBeans?
ОБНОВЛЕНИЕ:
Ниже приведен обновленный синтаксис, который будет работать в 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) {
Ответы
Ответ 1
В первой строке отсутствует звездочка *
: Попробуйте
/**
* 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
*/
Ответ 2
Дополнительная подсказка:
Netbeans может сделать это для вас:
public static function test($var1,$var2) {
return $array;
}
Теперь напишите:
/**[press enter]
public static function test($var1,$var2) {
return $array;
}
Тадаам:
/**
*
* @param type $var1
* @param type $var2
* @return type
*/
public static function test($var1,$var2) {
return $array;
}
Ответ 3
Вам нужно 2 ** при открытии комментариев для Netbeans, чтобы узнать это:
Должно быть
/**
*
*/
не просто обычный комментарий
/*
*
*/
Пример:
/**
* function description
*
* @param *vartype* ***param1*** *description*
* @param int param2 this is param two
* @return void
*/
Netbeans автоматически добавляет имя функции
@return является необязательным, но полезно
Ответ 4
Я верю, что способ начать свой комментарий функции
/**
* 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.
Ответ 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.
*/
Вы можете добавить с какой версии, какого пакета, какого субпакета добавить тип параметров, т.е. строку, mixed, bool и что такое возврат.