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

Mp *_*ega 14 php documentation phpdoc

好吧,我确实有我的类方法上面的这个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.
 */
Run Code Online (Sandbox Code Playgroud)

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

在我看到的其他文档中,mixed但它在我的带有PDT的Eclipse IDE中没有正确反映.

我的问题是我如何能够显示某种可能接受两种或更多种数据类型的标准方法@param.

注意:我给出的phpdoc是我现在正在使用的应用程序的现有文档.好吧,我被指派记录好一切.

Ian*_*ter 22

你做得对.所述PHPDoc的参考给出了参数,可以是多种数据类型(重点煤矿)这两个选项.

数据类型应该是有效的PHP类型(int,string,bool等),对象类型的类名,或者只是"混合".此外,您可以通过使用管道分隔单个参数来列出多个数据类型 (例如"@param int | string $ p1").