我使用PHP
在netbeans 7.3
中为类属性撰写了docblock注释。被注释的属性是一个关联数组,所以我想评论每个键。这是代码:
/**
* The expression being built.
*
* This will be pushed to the {@see $_parts} array when complete.
* <code>
* array(
* 'schema', # The qualified schema name
* 'table', # The qualified table name
* 'column', # The qualified column name
* 'alias', # A simple name for schema.table.column
* 'expr' # A nested (in parenthesis) Expression object.
* 'raw' # Used for unrecognized expressions.
* 'operator', # The operator comparing column and value
* 'value', # The value(s) to compare column against
* 'eval' # A callable method to do the compare.
* 'query' # A sub Query (or Transaction) object.
* )
* </code>
*
* @var mixed[]
*/
protected $_unit = array();
我希望<code>
块可以保留行格式。问题是,当使用“自动弹出文档窗口”时,注释中的新行字符将被忽略,并且所有多个空格都会压缩到单个空格。这使得阅读非常困难。
是否有其他方法可以保留格式,或至少使其可读?
答案 0 :(得分:2)
使用<pre>
标记周围的<code>
标记进行试用。否则只需使用<br>
。
<code> -- Use this to surround php code, some converters will highlight it
<pre> -- Preserve line breaks and spacing, and assume all tags are text (like XML's CDATA)
<br> -- hard line break, may be ignored by some converters
示例:
/**
* The expression being built.
*
* This will be pushed to the {@see $_parts} array when complete.
* <pre>
* <code>
* array(
* 'schema', # The qualified schema name
* 'table', # The qualified table name
* 'column', # The qualified column name
* 'alias', # A simple name for schema.table.column
* 'expr' # A nested (in parenthesis) Expression object.
* 'raw' # Used for unrecognized expressions.
* 'operator', # The operator comparing column and value
* 'value', # The value(s) to compare column against
* 'eval' # A callable method to do the compare.
* 'query' # A sub Query (or Transaction) object.
* )
* </code>
* </pre>
*
* @var mixed[]
*/