“Nessun suggerimento” in NetBeans
-
24-10-2019 - |
Domanda
Per qualche giorno ora sto usando NetBeans 6.8 per fare il lavoro di PHP. Ma anche se un file di classe è incluso ed i metodi sono pubblici e non c'è PHPDoc usati, NetBeans Everytime spettacoli "Nessun suggerimento" nella finestra.
es. tipo I
$user->
e premere CTRL + Spazio, mi aspetto tutti i metodi e le variabili, ma non ci sono mostrati alcuna. idee?
Soluzione
$foo = new Bar();
When ctrl click on Bar (or right click -> Go to definition) you should go the the Bar class.
To the __construct() to be precise.
If netbeans doenst jump, that means it doesn't know where the Bar class is defined.
$foo-> ctrl+space
Would then say "No suggestions"
In your case:
$user = new User();
$user->
If $user is a parameter:
/**
* @param User $user
*/
function myFunction($user) {
$user->
check that you got /**
and not just /*
If $user is retrieved via a function:
/**
* @return User
*/
function getUser() {
// impl
}
$user = getUser();
$user->
Altri suggerimenti
Make sure netbeans do know what is stored in $user
. Every method should have proper @return annotation with either scalar name/array or class name.
If user class is named User, your user getter should look like
/**
@return User
*/
function getUser() {
//some code
return $user; //instance of User
}