Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 768
k0pernikus Avatar asked May 27 '15 14:05

k0pernikus


People also ask

How to add PHPDoc in PhpStorm?

Press Alt+Insert , then select Generate PHPDoc blocks, and choose the code construct to generate PHPDoc comments for.

What is PHPDoc comment?

phpDoc blocks are descriptive comments that are part of the application code. They are used to describe the PHP element in the exact location in the code where the element appears. The block consists of a short description, long description, and phpDoc tags.


1 Answers

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.

like image 155
k0pernikus Avatar answered Oct 12 '22 01:10

k0pernikus