2012-09-17 67 views
0

中記錄允許的數組參數值我經常將一個數組作爲構造函數參數傳遞。我應該如何記錄允許的值?我嘗試了一些樣式,但在phpdoc中看起來有點亂。我應該如何在php

+0

我想這可能是最好明確定義要接受,而不是傳遞一個數組哪些參數。 – Lix

+0

如果您有很多參數,請考慮構建一個單獨的對象。 –

回答

2

真的是用於記錄哈希陣列沒有「官方」 PHPDoc的方式,但這裏有一個方法:

/** 
* @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){ 
}