1

The project that I am currently working on has the following coding standard.

Don't add phpdoc to inherited methods if it is just a copy of the parent class method's phpdoc. Add phpdoc to inherited methods only if it is different.

I am trying to achieve this with phpcs and want to conditionally enable the squiz.commenting.functioncomment.missing phpcs sniff.

I understand that phpcs will not have runtime information about the class (and its inheritance), so I don't think anything can be done at sniff or ruleset level.

But are there any other ways by which I can override the output of the phpcs command output? If yes, then I can hook into that code and then can conditionally hide the error messages if needed.

I see that we can use a bootstrap file with phpcs. Does the bootstrap file allow us to filter (or modify) the list of errors and warnings outputted by phpcs?

Sudar
  • 18,954
  • 30
  • 85
  • 131
  • You could probably ignore that sniff for every inherited methods using special comments (https://stackoverflow.com/a/52881595/6523409). The problem is that you should do this for every method. – Filip Š Nov 29 '18 at 10:41
  • @FilipŠ Yeah, that's what I am doing right now. It is not elegant but does the job. – Sudar Nov 29 '18 at 14:17

0 Answers0