Word Wrapping in Doc Blocks

Hi,
I thought I would ask this question here, before submitting a feature request.

The problem I'm trying to solve is my biggest gripe when editing doc blocks. It's easy enough to run on word wrapping, which does affect doc blocks, however the word wrapping does not auto wrap lines.

Let me give an example. Here is a pretty standard doc block I've written:

 /**
  * Set the name
  *
  * This sets the name of the person the object represents. Only alpha-numeric
  * values are allowed in the name, and an InvalidArgumentExcpetion exception
  * will be thrown in the name contains any other character.
  *
  * @param string $name Name of the person
  * @return bool
  */
 function setName($name)
 {

 }



Now imagine I forgot an important detail on the second line of the description, so I add that in, and PHPStorm automatically word wraps the line for me:

 /**
  * Set the name
  *
  * This sets the name of the person the object represents. Only alpha-numeric
  * values are allowed in the name for url safety, and an InvalidArgumentExcpetion
  * exception
  * will be thrown in the name contains any other character.
  *
  * @param string $name Name of the person
  * @return bool
  */
 function setName($name)
 {

 }



The problem here should be clear. PHPStorm wrapped the second line after I inserted the words "for url safety", but now the word "exception" sits on the third line all by itself. In a "real" text editor the rest of the sentence after "exception" would have moved up to the third line. There are similar problems when removing text.

I'm so tired of having to manually reformat doc blocks that have been edited over time, and I would love to have my IDE take care of those details for me. Can PHPStorm do this?

Please sign in to leave a comment.