PHP Docblocks - Explaining an array [duplicate]
Asked Answered
S

1

5

Possible Duplicate:
Is there a way for phpDoc to document an array of objects as a parameter?

I've been searching, and looked at the phpDocumentor documentation but cannot find if there is a way to properly document @param array (as in, declare the keys / values types expected) that will be parsed and included in any generated documentation.

This would lead me to believe there is no way to do it and I'll be resigned to using the description.

Thanks in advance.

Shah answered 30/1, 2013 at 20:11 Comment(1)
See github.com/phpDocumentor/phpDocumentor2/issues/650 for the proposalAbbreviated
S
3

@param YourType[] is recognized by at least Eclipse/Zend Studio. I don't know about other IDE's but would expect the same, even if that might not be official phpDocumentor syntax.

However I don't know of any way to document the types of the keys (which are limited to int and string anyway).

Saphra answered 30/1, 2013 at 20:15 Comment(3)
How would I document an array like this? array( 'key1'=>'value1', 'key2'=>2, 'key3'=>array( 'key4'=>'value4' ) ) It seems this may be a duplicate anyway. The linked questions has an answer that looks feasible. I will try and report back.Shah
either (string|int|string[])[] or simply mixed[] (semantically equal to array)Saphra
What about documenting the names of the keys? Documentation should reflect that the key value is key1 for example. UPDATE: under discussion at github.com/phpDocumentor/phpDocumentor2/issues/650Abbreviated

© 2022 - 2024 — McMap. All rights reserved.