idephpstormphpdocphpstorm-2017.2

PhpStorm: PHPDoc formatting setup


I'm trying to figure out if there is a way to make PhpStorm format dockblocks according to Laravel's guide

I know how to use settings in order to set it up as PSR-1/2 compliant and how to use the additional options to do some available formatting as shown on the screenshots:

PHPDoc code style enter image description here

What I cannot figure out is how to force it so that:

the @param attribute is followed by two spaces, the argument type, two more spaces, and finally the variable name

effectively giving me:

/**
 * Register a binding with the container.
 *
 * @param  string|array  $abstract
 * @param  \Closure|string|null  $concrete
 * @param  bool  $shared
 * @return void
 */

I can only get it to do the following (please notice single spaces after @param and argument type):

/**
 * Register a binding with the container.
 *
 * @param string|array $abstract
 * @param \Closure|string|null $concrete
 * @param bool $shared
 * @return void
 */

Is there any way of making it re-format the code to this spec?


Solution

  • There is simply no such option currently available.

    https://youtrack.jetbrains.com/issue/WI-18408 and related tickets -- watch them (star/vote/comment) to get notified on any progress.


    In mean time -- maybe you can use some 3rd party tool that can do such formatting? It can be invoked as External Tool manually (menu or shortcut) or maybe even as an File Watcher (runs on file modification).