Create/update PHPDOC comments in batch?

Hi all!

I have inherited a BIG project where the previous dev's didnt pay much attention to functions comments, so i have a lot of function like this:

class Foo{
   public function bar($a, $b, $c){
       //[do things]
       return array($d => $f);
   }
}

I saw that phpStorm suggest (and create) automatically the basilar phpdocs like:
 /**
  * @param $a
  * @param $b
  * @param $c
  *
  * @return array
  */

and also update where the comment missing some aspects (exceptions, return value, etc..)

Now im wondering if is possible to tell phpStorm to update automatically all the documentations in the current project, with or without preview.


Does anyone know how?

1 comment
Comment actions Permalink

Hi there,

Try this:

  1. Use "Code | Run Inspection by Name..." -- choose correct/desired inspection (search for "phpdoc"), e.g. "Missing PHPDoc comment"
  2. When done -- you will be able to apply "Generate PHPDoc comment" quick fix on all entries of that specific inspection type


P.S.
Please note that "Missing PHPDoc comment" inspection ignores methods if it has no parameters and has no return something statements; therefore you cannot create missing PHPDocs this way where only method description will be provided (since you have to enter description manually -- nothing to generate at all).

0

Please sign in to leave a comment.