Netbeans Define Variable Type in Comment

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

If you use Netbeans for PHP like me (its awesome) and you ever use any kind of function or method to return objects, then you will have noticed that Netbeans’ autocompletion doesn’t work for these variables.

However, you can make Netbeans work how you expect, by using some special comments.

Check out these two blog stories:

In a nutshell, you can define a variable as being a specific object by using a comment in this format:

/* @var  $o ObjectName  */
$o->/*autocomplete kicks in here */

That’s a really nice feature I think :)

Oh yeah, they are adding Zend Framework support as well !

If I ever see these guys, I’m definitely buying them a beer!