2010-12-05 13 views
28

He intentado lo siguiente,¿Cómo agregar documentación para mis funciones en 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); 

Pero, cuando traté de usarlo en otro lugar, dice PHPDoc no encontrado.

alt text

alguna idea sobre cómo conseguir que esto funcione en NetBeans PHP?

ACTUALIZACIÓN:

La siguiente es la sintaxis actualizada que trabajará en 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) { 

Respuesta

34

Usted se echa en falta un asterisco * en la primera línea: Pruebe

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

lo consiguió gracias. Hice una pequeña modificación en el nombre del parámetro, la descripción del parámetro también aparece ahora. :) – emaillenin

+0

Para aquellos que intentan obtener una descripción para aparecer en las clases: La descripción de la clase cuando se escribe 'new myClass' se saca del método constructor. Así que documente el constructor con la información (a diferencia o fuera de la clase) que desea mostrar en las sugerencias. – teynon

+0

@Pekka 웃, lo hice en netbeans 6.5.1 pero para el método java y al poner el mouse sobre el método y hacer clic en "controlar", la documentación no aparece. –

5

Creo que la manera de comenzar tu función es

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

Tenga en cuenta el asterisco doble para comenzar su comentario. Es posible que desee comprobar esto php documentor.

6

Se necesitan 2 ** en la apertura de los comentarios Netbeans reconocerlo:

Debe ser

/**   
*   
*/ 

no sólo un comentario regulares

/* 
* 
*/ 

Ejemplo:

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

Netbean s agrega automáticamente el nombre de la función

@ return es opcional, pero muy útil

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

Puede añadir desde qué versión, qué paquete, lo sub-paquete, añadir tipo de parámetros, es decir, la secuencia, mixta, bool, y lo es el regreso.

17

Consejo adicional: Netbeans puede hacer por usted:

public static function test($var1,$var2) { 
    return $array; 
} 

Ahora escribe:

/**[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; 
} 
+1

Gracias y +1 por la pista '[pulse enter] 'para generar el phpdoc automáticamente – Silvan

Cuestiones relacionadas