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:

http://blogs.sun.com/netbeansphp/entry/defining_variable_type_in_a

http://blogs.sun.com/netbeansphp/entry/defining_a_variable_type_in

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

$o=getObject('ObjectName');
/* @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 !

http://blogs.sun.com/netbeansphp/entry/zend_framework_support_added

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