We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 811fb22 commit d28b6d3Copy full SHA for d28b6d3
CodeSniffer/Standards/AbstractPatternSniff.php
@@ -379,8 +379,14 @@ protected function processPattern(
379
} else if ($pattern[$i]['type'] === 'newline') {
380
if ($tokens[$stackPtr]['code'] === T_WHITESPACE) {
381
if ($tokens[$stackPtr]['content'] !== $phpcsFile->eolChar) {
382
- $found = $tokens[$stackPtr]['content'].$found;
383
- $hasError = true;
+ $found = $tokens[$stackPtr]['content'].$found;
+
384
+ // This may just be an indent that comes after a newline
385
+ // so check the token before to make sure. If it is a newline, we
386
+ // can ignore the error here.
387
+ if ($tokens[($stackPtr - 1)]['content'] !== $phpcsFile->eolChar) {
388
+ $hasError = true;
389
+ }
390
} else {
391
$found = 'EOL'.$found;
392
}
0 commit comments