Search code examples
phpstormphpdoc

Sort PHPDoc parameters in PhpStorm


I'm moving from SublimeText to PhpStorm, and I was wondering something :

In SublimeText, with the PHPFMT plugin activated, the PHPDoc I wrote was rearranged to match a certain pattern :

  1. @see
  2. @params
  3. @throws
  4. @return

For instance, if I write this PHPDoc :

/**
 * StackOverflow test
 *
 * @throws Exception
 * @param  string $param1
 * @return bool
 * @param  string $param2
 * @param  string $param3
 * @see  http://stackoverflow.com/questions/41509189/sort-phpdoc-parameters-in-phpstorm
 */

It will be changed into this upon save :

/**
 * StackOverflow test
 *
 * @see  http://stackoverflow.com/questions/41509189/sort-phpdoc-parameters-in-phpstorm
 *
 * @param  string      $param1
 * @param  string      $param2
 * @param  string      $param3
 * @throws Exception
 * @return bool
 */

Does PhpStorm provide something like this ?


Solution

  • Unfortunately that is not possible in current versions. The best IDE can do right now with PHPDoc is to add blank lines in few places and align text.

    https://youtrack.jetbrains.com/issue/WI-14694 -- watch this ticket (star/vote/comment) to get notified on any progress.