I am wanting to utilize the variable type comment feature in NetBeans for PHP, yet I’m having trouble deciding upon the type itself.
I’ve got the syntax down (my variable is named $clause):
/* @var $clause type */
But when it comes to replacing type with something, I’m unsure of what to use. I used gettype($clause) to determine the type of variable in question, which outputted string, yet there is no string option in the drop down list for the autocompletion of the comment in NetBeans.
Furthermore the options that are listed are foreign to me to say the least, and I don’t imagine a developer is expected to use gettype every time they need to determine the type of variable in use.
Could someone give me some advice on the type to use? Is it string as I determined, or is this a user defined type?
I noticed in the documentation here that the types given as examples are Book and Movie, which match the class name in the given examples. My case does not contain a class, but there is no example that resembles my case.
I appreciate any help you can provide me. Thank you.
Uhm, I think you mean PHPDoc, no? It’s not a Netbeans feature…
The data type doesn’t really matter in the long run, it only helps you designing self-documented code.
Finally, if the
$clausevariable indeed contains a class name (most often a string), the DocBlock would look like:Note that docblocks must start with a slash and two asterisks.
The @var clause is in the format of “variable name”, “data type” and “description”.