phpStorm 7 update docblock

Steve picture Steve · Nov 7, 2013 · Viewed 14.2k times · Source

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)?

Answer

Maciej Sz picture Maciej Sz · Nov 8, 2013

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.