Question

For a few days now I'm using NetBeans 6.8 for doing PHP work. But even if a class-file is included and the methods are public and there's phpDoc used, NetBeans everytime shows "No Suggestions" in the window.

E.g. I type

$user->

and press CTRL+Space, I do expect all the methods and variables but there aren't shown any. ideas?

Was it helpful?

Solution

 $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->

OTHER TIPS

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
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top