Is there a way to ask phpStorm to update the contents of a docblock? eg if I have the following code
//-------------------------------------------------------------------------
/**
* @param string $url
* @return $this
*/
public function setBaseUrl($url)
{
$this->baseUrl = $url;
return $this;
}
and add another parameter
//-------------------------------------------------------------------------
/**
* @param string $url
* @return $this
*/
public function setBaseUrl($url, $anotherParameter)
{
$this->baseUrl = $url;
return $this;
}
is there a way to ask phpStorm to create the @param $anotherParameter in my docblock? (in a single keystroke or by menu selection)?
Alt+Enter
(Show Intention Actions) on the comment, then Enter
again.
This is configurable via [Settings > Keymap]
then [Other > Show Intention Actions]
Alternatively you can do the same with mouse if you click on the comment, and then on the yellow bulb that shows up.
I used to press Control-Enter inside the dock block and it used to update. And for some reason it stopped working.
Finally I figured that PHPStorm has changed its behavior.
Now you need to put the cursor on the missing variable name and then press Control-Enter. It will update the dock block.
And of course make sure that phpDoc inspection is enabled as Steve has mentioned in the comment. Also have a read of http://blog.jetbrains.com/webide/2011/05/phpdoc-inspections/
In the new version of PHPStorm 2016.x you need to place your cursor in the missing variable name and press alt + enter
then hit again enter
to add the missing param to the doc block. If you need to remove a parameter you need to go to the extra param and press the same key strokes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With