【问题标题】:PHPDoc: How to document different class property optionsPHPDoc:如何记录不同的类属性选项
【发布时间】:2012-03-29 19:27:03
【问题描述】:

phpdoc 有什么方法可以记录类属性可以采用的不同值以及这将产生什么影响。例如:-

class SomeClass {

   /**
   * Cell text align
   * 
   * null - table default
   * l - left align
   * r - right align
   * c - centre align
   * j - justify
   */
   public $align;

   Some code
}

有没有办法让 phpdoc 解析值-描述对,以便将它们变成定义列表之类的?

【问题讨论】:

  • 无关:您打算如何确保变量包含这些值?您是否考虑过带有公共 getter 和 setter 的受保护变量?

标签: php phpdoc


【解决方案1】:

这样的东西会在文档输出中变成<ul>

class SomeClass {

   /**
    * Cell text align
    * 
    * Possible values: 
    * - null - table default
    * - l - left align
    * - r - right align
    * - c - centre align
    * - j - justify
    */
   public $align;

   // Some code
}

来自the manual page on DocBlock description details

【讨论】:

  • 太棒了!非常感谢!
  • 很快我们就可以期待 PHPDocumentor 2 @ www.phpdoc.org,尽管截至本文发布时它还没有完成。
猜你喜欢
  • 2011-04-05
  • 1970-01-01
  • 2013-03-03
  • 1970-01-01
  • 1970-01-01
  • 2011-03-04
  • 1970-01-01
  • 1970-01-01
  • 2018-12-30
相关资源
最近更新 更多