Mohsen
Mohsen

Reputation: 292

Make a single-line comment in PhpStorm

How can I make PhpStorm with a short PHPDoc comments show the comment in a single line instead of multiple lines?

How that is displayed now:

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

I want this:

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

Upvotes: 6

Views: 1421

Answers (2)

ZaNdaLeX
ZaNdaLeX

Reputation: 11

You can try to use:

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

Upvotes: -1

Enver Arslan
Enver Arslan

Reputation: 749

You can change Function Doc Comment Template for PhpStorm like this:

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

*

But single line doc approach is not useful. Because; functions can take multiple parameters, can return different objects, can have proper explanation of what it does. Why do you limit yourself?

You can use single line doc for variables and properties. Write above them: /** and press space.

Upvotes: 8

Related Questions