在 PhpStorm 中进行单行注释

Make a single-line comment in PhpStorm

如何让带有简短 PHPDoc 注释的 PhpStorm 在单行而不是多行中显示注释?

现在的显示方式:

/**
 * @return int[]
 */
public static function defaultAccountValidationCollection(){}

我想要这个:

/** @return int[] */
public static function defaultAccountValidationCollection(){}

您可以像这样更改 PhpStorm 的函数文档注释模板:

/** ${PARAM_DOC} #if (${TYPE_HINT} != "void") @return ${TYPE_HINT} #end ${THROWS_DOC} */

但是单行文档方法没有用。因为;函数可以接受多个参数,可以 return 不同的对象,可以对它的作用有适当的解释。为什么要限制自己?

您可以对变量和属性使用单行文档。在它们上面写上:/** 然后按 space

您可以尝试使用:

PhpStrom - Editor - File and Code Templates - Includes

#if (${PARAM_DOC} == "") && (${THROWS_DOC} == "")
    /*** @return ${TYPE_HINT} */
#else
/**
${PARAM_DOC}
#if (${TYPE_HINT} != "void") * @return ${TYPE_HINT} #end
${THROWS_DOC}
*/
#end