@param在类中是什么意思? [英] What does @param mean in a class?

查看:1489
本文介绍了@param在类中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@param在创建类时意味着什么?据我所知,它是用来告诉脚本什么样的数据类型的变量是什么样的值函数返回,是吗?
例如:

What does the @param mean when creating a class? As far as I understand it is used to tell the script what kind of datatype the variables are and what kind of value a function returns, is that right? For example:

/**
 * @param string $some
 * @param array $some2
 * @return void
 */

Isn't还有另外一种方法来做,我想像的事情: void function(){...} 或类似的东西。对于变量可能是(int)$ test;

Isn´t there another way to do that, I am thinking of things like: void function() { ... } or something like that. And for variables maybe (int)$test;

推荐答案

@param 在PHP中没有特殊的含义,它通常在注释中用来写文档。

@param doesn't have special meaning in PHP, it's typically used within a comment to write up documentation. The example you've provided shows just that.

如果您使用文档工具,它将会清除 @param @summary 和其他类似的值(取决于工具的复杂程度)自动生成代码的格式良好的文档。

If you use a documentation tool, it will scour the code for @param, @summary, and other similar values (depending on the sophistication of the tool) to automatically generate well formatted documentation for the code.

这篇关于@param在类中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆