Eclipse PHP 代码格式化程序从@return注释中删除管道符号


Eclipse PHP code formatter removes pipe symbols from @return comments

我正在使用Eclipse Kepler (4.3.1)进行PHP项目。

我偶然发现了 PHP 的 eclipse 代码格式化程序的一个问题,涉及 PHPDoc 的管道(竖线)符号@return:当有这样的评论时:

<?php
/**
 *
 * @param string|array The parameter. Either a string or an array.
 * @return int|string The return value. Either an int or a string.
 */
function test($param) {
}

将格式函数与 [CTRL]+[SHIFT]+[F] 一起使用可得到:

<?php
/**
 *
 * @param
 *          string|array The parameter. Either a string or an array.
 * @return int string return value. Either an int or a string.
 */
function test($param) {
}

如您所见,"@return"语句中"int"和"string"之间的管道符号已被空格取代。但不仅如此。描述的第一个单词("The")也被砍掉了。另一方面,它适用于"@param"语句。

phpdoc.org 指出,在处理不明确的返回值时使用管道符号:phpdoc-@return

就在几天前,有人在Eclipse社区论坛:论坛帖子中问了一个关于这个问题的问题。

使用"@formatter:off"和"@formatter:on"是不可选择的,因为此设置只是本地设置,其他人可能没有设置它。

有谁知道如何修复配置日食 php 代码格式化程序?有人有解决方法吗?

这被报告为一个错误 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=431979