PHPdoc @param中的两个或多个数据类型

前端之家收集整理的这篇文章主要介绍了PHPdoc @param中的两个或多个数据类型前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
好的,我有这个PHPdoc上面的我的类方法
/**
 * this a function that translates the text
 * @param string|boolean $lang if string the string given in the parameter will be the language code that will represent the language desired,if true,this will translate based on the website's current language,if false will not translate.
 */

现在我的问题是,我如何定义可以接受字符串和布尔值的$lang的数据类型.

在其他文档中,我看到混合,但它没有正确地反映在我的Eclipse IDE与PDT.

我的问题是如何显示一个@param可以接受两种或更多类型的数据类型的标准方法是什么.

注意:我给出的PHPdoc是我现在正在工作的应用程序的现有文档.那么我被分配好记录一切.

你做的正确 PHPDoc reference给出了这两个可以是多种数据类型(重点在于我)的参数选项.

The datatype should be a valid PHP type (int,string,bool,etc),a
class name for the type of object,or simply “mixed”. Further,you can
list multiple datatypes for a single parameter by delimiting them with
the pipe (e.g. “@param int|string $p1”).

原文链接:https://www.f2er.com/php/130794.html

猜你在找的PHP相关文章