Is there a PHPCS coding standard that would check that proper annotations (@param, @return, @throws, etc.) are present in a docblock, including the proper spacing between them?
Is there a PHPCS coding standard that would check that proper annotations ( @param
Share
Try running the following command and see if it produces what you want:
phpcs /path/to/code --standard=Squiz --sniffs=Squiz.Commenting.FunctionComment,Squiz.Commenting.FunctionCommentThrowTag,Squiz.Commenting.ClassComment,Squiz.Commenting.FileComment,Squiz.Commenting.VariableCommentIf it does, you could create your own standard that just includes those sniffs, and anything else you want to check. You do this by creating a
ruleset.xmlfile and using that as your standard.For example, you could create a file called
mystandard.xmland include the following content:Then you can run this command instead:
There are other things you can do in a
ruleset.xmlfile. See the docs here: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset