views:

95

answers:

1

Hey Guys, i hope someone can help me out on this one here. I use several associative arrays in my php application and i'm using php documentor to comment my sources. I never really did specified comments for the arrays in an array, but now i need to do that and dont know how.

$array = array('id' => 'test', 'class' => 'tester', 'options' => array('option1' => 1, 'option2' => 2))

So how do i comment this array in the correct way for @var and @param comments? I could do this like this, but dunno, if this is correct:

@param string $array['id']
@param string $array['class']
@param int $array['options']['option1']

But how to this for the var part?

I hope someone can lead me to the right direction. Thanks in advance for any help.

Regards

+2  A: 

You can't document each key, but you can tell phpDocumentor what type it is.

You could do something like this:

/**
 * Form the array like this:
 * <code>
 * $array = array(
 *   'id'      => 'foo',          // the id
 *   'class'   => 'myClass',     // the class
 * );
 * 
 * </code>
 *
 * @var array[string]string 
 */
$array;
Stephen J. Fuhry
thanks for your help ;)
Abenil