Defining a variable type in comment
By Petr on Jan 06, 2009
Yesterday was the first day at work this year and we committed new feature, which allow to define a type for a variable in a comment. The comment has to be defined in specific form as is displayed on the picture.
The comment has to be /\* @var $variable type \*/ . If the comment is written in the right form, then the var tag has bold font.
You can use this helper, when NetBeans is not able to recognize the type of the variable. On the picture below you can see that NetBeans recognizes that the variable $media in the echo statement is Book type. But then another object is assigned to the $media variable through the getLastMovie() function. This function defines the return type Movie, so from this line NetBeans knows that $media variable contains an object of Movie type.
NetBeans handles the variable name and the type from the comment helper as are handled in PHP Doc. So for example mark occurrences works as usual.
Next time I will show you how NetBeans can help you with writing the comment helper.