phpcs doesn't recognize docblock templates
Author: jpuckCreated May 10, 2018Updated Mar 9, 2026
LabelsType: enhancement
Please enlighten me if I'm missing a configuration, but phpcs doesn't seem to recognize docblock templates.
For example,
/**#@+
* @const string Comparison constants
*/
const EQUAL = '==';
const NOT_EQUAL = '!=';
const GREATER_THAN = '>';
const LESS_THAN = '<';
const GREATER_THAN_EQUAL = '>=';
const LESS_THAN_EQUAL = '<=';
/**#@-*/
/**
* @var string Some value
*/
protected $foo = 'bar';will return this error:
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
56 | ERROR | [x] Expected 1 blank line(s) before member var; 2 found (Squiz.WhiteSpace.MemberVarSpacing.Incorrect)
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLYbut to "fix" it would remove /**#@-*/ because it thinks it's a blank line, which breaks the docblock.
Thanks in advance for your assistance, and all your hard work on this project!
Source: squizlabs/PHP_CodeSniffer