k0pernikus k0pernikus - 1 year ago 63
PHP Question

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

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.


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.