Unfortunately, I still have to program for PHP 4, or this would be less of an issue since PHP5 has private and public declarations, etc...but even in PHP5, it could be useful...
Anyway, I was looking for a way to define large groups of class methods or variables so that I don't have to do the same phpDoc comments over and over again like so:
/**
* @var string $var1
* @access private
*/
var $var1;
/**
* @var string $var2
* @access private
*/
var $var2;
|
When I looked into it online, I found some info on "DocBlock Templates" on wikipedia:
http://en.wikipedia.org/wiki/PHPDoc
This template should supposedly allow you to make a "private" or "protected" declaration, etc., one time and have it apply to all variables/methods that are within that template. The template would start like so:
/**#@+
* @access private
*/ |
This template is then applied to every element until it hits the template ending comment:
It would be very useful in my opinion, to be able to define groups of variables with the DocBlock templates and have those reflected in the Code Insight, which currently doesn't appear to be reading those templates correctly at all, as doing things like the following would greatly reduce redundancy:
/**#@+
* @var string
* @access private
*/
var $var1, $var2, $var3, $var4, $var5, $var6;
/**#@-*/
/**#@+
* @var bool
* @access public
*/
var $is1, $is2, $is3, $is4, $is5, $is6;
/**#@-*/ |
Zend Studio, which I quit using because of it's local/remote handling does a bit of a better job in the phpDoc department, as it will actually apply the phpDoc comment to all variables in a comma delimited list of variables even if there is no "DocBlock Template". For my purposes, even doing it that way would suffice, though the Template method has more overall use.
Anyway, if there already is a way to do this and I simply don't know about it, if someone could correct me and let me know how, that would be appreciated...i've tried various things, but the phpDoc comments always only gets applied to the first variable in a comma delimited list. So, if there's a way to better comment this without separating each variable one-by-one and still get phpEd to parse it and give the code insight, that would be great.
Otherwise, I'll just leave it as my request...to support DocBlock templates...or at the very least make it so that the same comments will apply to all variables in a comma-delimited list.
Also, I know this has been brought up elsewhere, but some beautification on the phpDoc comments to have the asterisk characters lined up (subsequent lines after the first line, add one space before asterisk).
Thanks,
Kevin