PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Squiz/VariableComment: make errorcode for "TagNotAllowed" warning modular
Description
Squiz/VariableComment: make errorcode for "TagNotAllowed" warning modular
As things are, the VariableComment sniff only allows @see tags and @var tags in property docblocks.
This practice feels dated to me, as commonly used tags, such as @link, @deprecated etc are not allowed.
This commit replaces the generic TagNotAllowed error code in the sniff with a more modular [TagName]TagNotAllowed error code.
This allows for rulesets to selectively ignore the TagNotAllowed error code for specific tags the ruleset maintainer wants to allow for the code base under scan.
Includes tests.
CS: allow @link and @deprecated in property docblocks
... for this codebase.
Suggested changelog entry
Changed:
- The error code
Squiz.Commenting.VariableComment.TagNotAllowedhas been replaced by a dynamicSquiz.Commenting.VariableComment.[TagName]TagNotAllowederror code.- This allows for selectively allowing specific tags by excluding the error code for that tag.
- Example: to allow
@linktags in property docblocks, exclude theSquiz.Commenting.VariableComment.LinkTagNotAllowederror code.