Skip to content

Commit 10126c7

Browse files
committed
Generic/HereNowdocIdentifierSpacing: add metrics
This commit adds metrics to the new `Generic.WhiteSpace.HereNowdocIdentifierSpacing` sniff to allow for collecting statistical information on how often spacing is found between the `<<<` and the doc ID.
1 parent 9e60f9f commit 10126c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Standards/Generic/Sniffs/WhiteSpace/HereNowdocIdentifierSpacingSniff.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ public function process(File $phpcsFile, $stackPtr)
4848
&& strpos($tokens[$stackPtr]['content'], "\t") === false
4949
) {
5050
// Nothing to do.
51+
$phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'no space between <<< and ID');
5152
return;
5253
}
5354

55+
$phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'space between <<< and ID');
56+
5457
$error = 'There should be no space between the <<< and the heredoc/nowdoc identifier string';
5558
$data = [$tokens[$stackPtr]['content']];
5659

0 commit comments

Comments
 (0)