0

Is it possible to delete/remove all PHPDoc from all files or File that we are working on?

enter image description here

I mean this things and all other comments like that PHPDoc etc

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 1
    Why exactly do you want to remove them? They are useful for self-documenting + providing typehints (for IDE to offer correct methods on objects/verify acceptable values for parameters etc). Framework itself relies on them (in some places, like DI). But ion any case: no -- if you wish to actually physically remove them you will have to do it manually or by some special tool. The best IDE can do for you here is to fold them so each of them occupy only one line. – LazyOne Aug 11 '17 at 16:32
  • They affect really bad my personal readability, it makes also highlighting errors on change parameters etc... iritating for me, doesn't help me at all, just makes me feel bad, etc – Emily Virginita Aug 11 '17 at 16:36
  • @LazyOne at least I want to delete them from my files, controllers. But I how to do it at one click or something? – Emily Virginita Aug 11 '17 at 16:37
  • 1
    As I have said -- there is no known to me way to do that (to quickly remove them). As far as I'm aware IDE simply does not have such functionality -- usually people asking other way around (how to quickly generate such comments/how to use typehints properly so they help in code completion etc). The only thing right now I can think of -- use regex Find and Replace... – LazyOne Aug 11 '17 at 16:41
  • @LazyOne waste that this is not built in – Emily Virginita Aug 11 '17 at 16:59

2 Answers2

2

There are many options to consider:

Jaime
  • 5,435
  • 2
  • 18
  • 21
0

In 2022, now have a rule in the inspection section: File > Settings > Inspections, then PHPDoc and finally Redundant PHPDoc comment. I changed it to a Weak Warning first, then went to one of the classes I had the issue and ran Code > Inspect Code, only on that file. Click on Analyse.

A panel of Inspection results will show up and Redundant PHPDoc comment, will show in PHP > PHPDoc section. Click on it, and on the right side, you will have another button "Run inspection on ...". That will run an inspection ONLY for that rule. Click on it and choose a custom scope or the whole project. Click Ok.

Now the inspection results will show all occurrences of that case. You can click on the first file on the left panel and SHIFT + click the last one and finally click the "Remove redundant PHPDoc comment" button on the right panel.

Not really intuitive, but did the trick for me.