I'm implementing PHPCS for an existing project. I want to check if functions has a docblock.
I'm currently using the following rules:
<rule ref="Squiz.Commenting.FunctionComment" />
<rule ref="Squiz.Commenting.FunctionCommentThrowTag" />
<rule ref="Squiz.Commenting.VariableComment" />
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="absoluteLineLimit" value="120"/>
<property name="lineLimit" value="120"/>
</properties>
</rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="print" value="echo"/>
<element key="var_dump" value="null"/>
<element key="dd" value="null"/>
<element key="dump" value="null"/>
<element key="echo" value="null"/>
<element key="print_r" value="null"/>
<element key="var_export" value="null"/>
</property>
</properties>
</rule>
But i get a lot of issue's that a Parameter comment should start with a capital letter and end with a fullstop.
How can i make the rules less strict regarding the capital letters & fullstops
Edit: Currently code block also wants to align the parameters. This creates a lot of ugly whitespace between @param array
and $parameter
. Can i remove this rule aswell in phpcs & phpcbf?
Run PHPCS with the -s command line argument so you can see the error codes next to each message. Then you can exclude these specific messages in your ruleset by setting their severity to 0.
In this specific case, you will probably want to add these 4 exclusions to your ruleset:
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentFullStop">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>