Skip to content

Commit

Permalink
Generic/HereNowdocIdentifierSpacing: add metrics
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jrfnl committed Oct 20, 2024
1 parent 9e60f9f commit 10126c7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ public function process(File $phpcsFile, $stackPtr)
&& strpos($tokens[$stackPtr]['content'], "\t") === false
) {
// Nothing to do.
$phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'no space between <<< and ID');
return;
}

$phpcsFile->recordMetric($stackPtr, 'Heredoc/nowdoc identifier', 'space between <<< and ID');

$error = 'There should be no space between the <<< and the heredoc/nowdoc identifier string';
$data = [$tokens[$stackPtr]['content']];

Expand Down

0 comments on commit 10126c7

Please sign in to comment.