How to update and generate DocBlock for the entire project in PhpStorm?

k0pernikus picture k0pernikus · May 27, 2015 · Viewed 12.6k times · Source

I have set up code inspection for php doc blocks, so now I will get warning if they are missing or incomplete.

Code inspection for PHPDoc

When I have one class open, I can use Code > Generate > PhpDocBlocks to generate them or just start a comment via /* in front of a method and it will be added.

Also, if exsiting doc blocks are incomplete or wrong, I can use Update DocBlock in order to match the DocBlock of a method to the actual method's signature.

Is there a way of applying these, both the doc block generation and, if necessary, the update of a doc block over the entire codebase without manually initializing this in each class?

I am looking for a batch process.

Answer

k0pernikus picture k0pernikus · May 27, 2015

In the project overview, you can right click a folder and select Inspect Code. It's also available via Code > Inspect Code.

A window will pop up asking you for further detail and you also can expect the scope to whole context.

Make sure your Inspection Profile contains PHPDoc. If the inspection has run through, you then will have a PHPDoc section,

Result of Code Inspection

By right clicking you then can Apply Fix even for multiple classes.