NetBeans:选择要放在注释中的变量类型
我想利用 NetBeans for PHP 中的变量类型注释功能,但在决定类型本身时遇到困难。
我已经掌握了语法(我的变量名为 $clause
):
/* @var $clause type */
但是当涉及到用某些东西替换 type
时,我不确定该使用什么。我使用 gettype($clause)
来确定相关变量的类型,该变量输出 string
,但 drop 中没有 string
选项NetBeans 中注释自动完成的下拉列表。
此外,至少可以说,列出的选项对我来说是陌生的,而且我不认为开发人员应该使用 gettype every他们需要确定正在使用的变量类型的时间。
有人可以给我一些关于使用类型的建议吗?是我确定的字符串,还是用户定义的类型?
我在文档此处中注意到作为示例给出的类型是Book 和
Movie
,它们与给定示例中的 class
名称相匹配。我的案例不包含类
,但没有与我的案例类似的示例。
我感谢您能为我提供的任何帮助。谢谢。
I am wanting to utilize the variable type comment feature in NetBeans for PHP, yet I'm having trouble deciding upon the type itself.
I've got the syntax down (my variable is named $clause
):
/* @var $clause type */
But when it comes to replacing type
with something, I'm unsure of what to use. I used gettype($clause)
to determine the type of variable in question, which outputted string
, yet there is no string
option in the drop down list for the autocompletion of the comment in NetBeans.
Furthermore the options that are listed are foreign to me to say the least, and I don't imagine a developer is expected to use gettype
every time they need to determine the type of variable in use.
Could someone give me some advice on the type to use? Is it string
as I determined, or is this a user defined type?
I noticed in the documentation here that the types given as examples are Book
and Movie
, which match the class
name in the given examples. My case does not contain a class
, but there is no example that resembles my case.
I appreciate any help you can provide me. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我想你的意思是 PHPDoc,不是吗?这不是 Netbeans 功能...
从长远来看,数据类型并不重要,它只会帮助您设计自记录代码。
最后,如果
$clause
变量确实包含类名(通常是字符串),则 DocBlock 将如下所示:请注意,docblocks 必须以斜杠和两个星号开头。
@var子句的格式为“变量名”、“数据类型”和“描述”。
Uhm, I think you mean PHPDoc, no? It's not a Netbeans feature...
The data type doesn't really matter in the long run, it only helps you designing self-documented code.
Finally, if the
$clause
variable indeed contains a class name (most often a string), the DocBlock would look like:Note that docblocks must start with a slash and two asterisks.
The @var clause is in the format of "variable name", "data type" and "description".