Last Updated: February 25, 2016
· mauris

Define variable typing in NetBeans IDE

To define the variable type for a PHP variable for sake of auto-completion in NetBeans IDE, simply type the shortcut


and press Tab. This will generate a comment that looks like this:

/* @var $variable Example */

After that line in the same variable scope, you will be able to see auto-complete for methods and properties of Example class when you type:


This type-hinting is namespace friendly in PHP 5.3 and 5.4. I work mainly with PHP 5.3.