Since we aren't always sure when opening a PR what the final released version will be, we always use x.x.x for those statements, which is fine for function, method or parameter statements but will get flagged when using it for hooks. We always update these x.x.x statements before a release so I think we can just ignore these particular sniff by adding the following to our phpcs.xml.dist file:
<rule ref="WooCommerce.Commenting">
<!-- It wants @since to contain defined version and does not allow just x.x.x -->
<exclude name="WooCommerce.Commenting.CommentHooks.MissingSinceVersionComment"/>
</rule>
Describe the Bug
We use the
woocommerce/woocommerce-sniffs
package for our PHPCS sniffs. There is one sniff here (WooCommerce.Commenting.CommentHooks.MissingSinceVersionComment
) that will throw an error if a@since
statement is added to a hook doc but doesn't contain a valid value. Reference failure here: https://github.com/woocommerce/woocommerce-square/actions/runs/9600765725/job/26477782151Since we aren't always sure when opening a PR what the final released version will be, we always use
x.x.x
for those statements, which is fine for function, method or parameter statements but will get flagged when using it for hooks. We always update thesex.x.x
statements before a release so I think we can just ignore these particular sniff by adding the following to ourphpcs.xml.dist
file:To Reproduce
See the following PHPCS error on the #615 PR: https://github.com/woocommerce/woocommerce-deposits/actions/runs/9649327093/job/26612562501
Can also check out this branch locally (
fix/586
) and run PHPCS locally to see the failure: