简体   繁体   English

@param注释在symfony2类文件中的作用是什么

[英]What purpose does @param annotation does in symfony2 class file

In the symfony2 and doctrine 2. I have this 在symfony2和教义2中。

 /**
  * Find a user by its username.
  *
  * @param string  $username
  * @return UserInterface or null if user does not exist
  */
function findUserByUsername($username);

Now i want to know that does it solve nay purpose or does it do anything in database with those @param and @return annotation or they just for documentation 现在我想知道它是解决问题的目的还是使用@param@return注释在数据库中执行任何操作,或者仅用于文档编制

@param is explained in the phpDocumentor docs . @param在phpDocumentor docs中进行了解释。 It has nothing to do with Symfony2. 它与Symfony2无关。

The link is outdated. 链接已过期。

Here is a link to a good address at this present moment. 这是目前链接到一个好的地址的链接。

https://www.phpdoc.org/docs/latest/references/phpdoc/tags/param.html https://www.phpdoc.org/docs/latest/references/phpdoc/tags/param.html

Below, the first lines of the explanation in any case... 以下是任何情况下的解释的第一行...

The @param tag is used to document a single argument of a function or method. @param标记用于记录函数或方法的单个参数。

With the @param tag it is possible to document the type and function of a single argument of a function or method. 使用@param标记可以记录函数或方法的单个参数的类型和函数。 When provided it MUST contain a Type to indicate what is expected; 如果提供,它必须包含一个类型以指示期望的内容; the description on the other hand is OPTIONAL yet RECOMMENDED in case of complicated structures, such as associative arrays. 另一方面,在复杂的结构(如关联数组)的情况下,说明是可选的,但建议这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM