Often I am passing an array as a constructor parameter. How should I document the allowable values? I have tried a few styles but they look a bit of a mess in phpdoc.
2
-
I think it might be better to explicitly define what parameters you want to receive as opposed to passing an array.Lix– Lix2012-09-17 00:35:11 +00:00Commented Sep 17, 2012 at 0:35
-
If you've got lots of params, consider building a separate object(s).Philip Whitehouse– Philip Whitehouse2012-09-17 01:42:53 +00:00Commented Sep 17, 2012 at 1:42
Add a comment
|
1 Answer
There really is no "official" phpdoc way for documenting hashed arrays but here's one way:
/**
* @param array $options hash of standard options for this class:
* int id the id of whatever object
* string name name of whoever it is
* array sub_option hash of sub options:
* int num number description for this index
* bool is_good should we do this or not?
*/
function __construct( $options ){
}