After I create a method I use /**<enter>
to generate the DocBlock. It auto fills the @param
and @return
for that function.
Example:
/**
*
* @param type $str
* @return type
*/
public function strlen($str){
return strlen($str);
}
How can I customize the block being generated so that it also fills in the @author
and end up with this after /**<enter>
/**
*
* @param type $str
* @return type
* @author John Doe <[email protected]>
*/
public function strlen($str){
return strlen($str);
}
Thanks
There may be a better way to do this, but here's what I've used: under Tools > Options > Editor > Code Templates, there are some predefined combos for generating code quickly. One of the default templates in 7.0 is:
vdoc<tab>
This generates a pseudo-docblock and the variable definition. You can replace this and add new ones that expand into whatever text you want, much like vim abbreviations. You can find more on this on the Netbeans documentation site:
http://netbeans.org/kb/docs/php/code-templates.html#using-templates
I believe the answer you're looking for will be found here: phpDocumentor Tutorial
I think you'll want to look at the --customtags Command-line switch.
So most likely, when you go to Tools -> Options -> "PHP" -> "PHPDoc", you can add that --customtags command-line switch into the PHPDoc script line.
I haven't attempted this personally, but I have been playing around with the idea of using NetBeans in combination with DocBlocks and PHPDocumentor to "automagically" create a good amount of usable documentation without being too strenuous on the rest of the coders. ;-)
There's a nice video tutorial about setting up NetBeans to work with PHPDocumentor available here: Generating PHP Documentation With NetBeans IDE 7.0
To enable proper @author tag autocompletion, just go to: Tools->Templates->PHP->PHP Class, press the "Settings" button and uncomment the line starting with #user=
.
Now you're able to edit the name and email, which are passed to your Class comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With