Documenting Unknown Data Type In Method Comments for PHP
I have a method in a class that sanitizes data that will be input into a mysql database. It takes two parameters, $data of unknown data type and $html_allowed of bool type. The data type of the $data variable will not initially be known by the method. In the comments, how do 开发者_Python百科I document an unknow data type? Right now my comments look like this:
/**
* Sanitizes database input to prevent sql injections.
*
* @param unknown $data
* @param bool html_allowed
* returns unknown $data
*/
Is this ok, or is there a better/standardized way?
You can use @mixed
if the argument can be of multiple types.
精彩评论