开发者

Documenting Unknown Data Type In Method Comments for PHP

开发者 https://www.devze.com 2023-03-17 23:29 出处:网络
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 va

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号