- πΊπΈUnited States Todd Zebert Los Angeles, CA
We're facing this same issue. I've narrowed it down to this code
$fix = $phpcsFile->addFixableError($error, ($i + 1), 'BlankLinesFound');
returns TRUE, which makes the following conditional TRUE, so then the final line$phpcsFile->fixer->replaceToken(($i + 1), '');
replaces the brace with empty string. Unfortunately I'm not following the overall logic to know what's the real issue is.I've included screenshots of xdebug vars, so one should be able to make out what's happening here.
// We changed lines. if ($foundContent === false) { // Before we throw an error, make sure we are not looking // at a gap before the style definition. $prev = $phpcsFile->findPrevious(T_WHITESPACE, $i, null, true); if ($prev !== false && isset($endTokens[$tokens[$prev]['code']]) === false ) { $error = 'Blank lines are not allowed between class names'; $fix = $phpcsFile->addFixableError($error, ($i + 1), 'BlankLinesFound'); if ($fix === true) { $phpcsFile->fixer->replaceToken(($i + 1), ''); } } break; }