微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.jb51.cc/php/130794.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐