views:

136

answers:

2

I have objects with many variables that I declare and explain in the comments. I am commenting very thoroughly for later processing using phpDoc, however I have no experience with actually compiling the documentation yet.

I find it very annoying that with phpDoc notation, each variable eats up four to six lines of code even if the only attribute I want to set is the description:

/**
 * @desc this is the description
 */

 var $variable = null;

I would like to use the following notation:

# @desc this is the description
var $variable = null;

is there a simple way to tweak phpDoc into accepting this, or will it give me trouble when I actually try to compile documentation out of it? I don't need the tweak now (although it's appreciated of course), just a statement from somebody who knows phpDoc whether this is feasible without having to re-engineer large parts of its code.

+6  A: 

Just write one-line docblocks

/** @desc this is the description */
var $variable = null;

Problem solved.

Frank Farmer
Didn't know that. That will work well, thanks.
Pekka
+2  A: 

In addition to what Frank Farmer mentioned (+1 to his solution),

/** is declared as T_DOC_COMMENT in the PHP tokenizer since PHP 5. This means to say that documentation notation are all parsed from /** to */.

You can't just use # or /* to write your PHP documentations.

See:

http://www.php.net/manual/en/tokens.php

thephpdeveloper
Well, obviously you could, but I gather you would have to change PHPDoc (which is not what I'm looking to do).
Pekka
read again, I am adding on to what Frank said.
thephpdeveloper
I still can't see why it wouldn't be possible to use # or /* for documentation if you change the parsing of phpDoc accordingly? Would you care to elaborate?
Pekka
Why would you want to change the parsing of phpDoc?
thephpdeveloper
Why not? I don't see anything wrong with people changing phpDoc to suit their needs. As I said, I am not planning to do that given the solution I have been presented. However for the sake of future generations who may stumble across this, I would like it to be said that you *can* use # or /* to write your PHP documentations, if you really need to; it may just be connected with some work.
Pekka