Как добавить документацию для моих функций в 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 не найден.

альтернативный текст

Есть идеи, как заставить это работать в 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) {

person Lenin Raj Rajasekaran    schedule 05.12.2010    source источник


Ответы (5)


Вы пропустили звездочку * в первой строке: Попробуйте

/**
 * 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
 */
person Pekka    schedule 05.12.2010
comment
понял, спасибо. Я немного изменил имя параметра, теперь отображается описание параметра. :) - person Lenin Raj Rajasekaran; 05.12.2010
comment
Для тех, кто пытается получить описание для классов: описание класса при вводе new myClass извлекается из метода конструктора. Поэтому задокументируйте конструктор с информацией (вместо или в дополнение к внешней стороне класса), которую вы хотите отображать в подсказках. - person teynon; 23.04.2013
comment
@Pekka 웃, я сделал это в netbeans 6.5.1, но для метода Java и при наведении мыши на метод и управлении щелчком документация не появляется. - person Mahmoud Saleh; 15.05.2013
comment
Кто-нибудь знает ярлык для него? - person Mustafa Magdi; 04.04.2016
comment
@MustafaMagdi Взгляните на ответ Бенджамина Пойнанта -› в Netbeans /**[press enter], и вы автоматически получите свой phpdoc (если функция существует) - person Silvan; 09.06.2016

Дополнительный совет: 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;
}
person Benjamin Poignant    schedule 14.11.2014
comment
Спасибо и +1 за подсказку [press enter] для автоматического создания phpdoc - person Silvan; 09.06.2016

Вам нужно 2 ** при открытии комментариев, чтобы Netbeans распознал его:

Должно быть

/**         
 *           
 */

не обычный комментарий

/*
 *
 */

Пример:

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

Netbeans автоматически добавляет имя функции

@return необязателен, но полезен

person Community    schedule 07.11.2012

Я считаю, что способ начать комментарий к функции

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

person A Salcedo    schedule 05.12.2010

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

Вы можете добавить, начиная с какой версии, какой пакет, какой подпакет, добавить тип параметров, т.е. строку, смешанный, логический, и что будет возвращаться.

person toha    schedule 23.04.2013