public function revertToken($stackPtr)
{
if (isset($this->_fixedTokens[$stackPtr]) === false) {
return false;
}
if (PHP_CODESNIFFER_VERBOSITY > 1) {
$bt = debug_backtrace();
if ($bt[1]['class'] === 'PHP_CodeSniffer_Fixer') {
$sniff = $bt[2]['class'];
$line = $bt[1]['line'];
} else {
$sniff = $bt[1]['class'];
$line = $bt[0]['line'];
}
$tokens = $this->_currentFile->getTokens();
$type = $tokens[$stackPtr]['type'];
$oldContent = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr]);
$newContent = PHP_CodeSniffer::prepareForOutput($this->_fixedTokens[$stackPtr]);
if (trim($this->_tokens[$stackPtr]) === '' && isset($tokens[$stackPtr + 1]) === true) {
// Add some context for whitespace only changes.
$append = PHP_CodeSniffer::prepareForOutput($this->_tokens[$stackPtr + 1]);
$oldContent .= $append;
$newContent .= $append;
}
}
//end if
$this->_tokens[$stackPtr] = $this->_fixedTokens[$stackPtr];
unset($this->_fixedTokens[$stackPtr]);
$this->_numFixes--;
if (PHP_CODESNIFFER_VERBOSITY > 1) {
$indent = "\t";
if (empty($this->_changeset) === false) {
$indent .= "\tR: ";
}
@ob_end_clean();
echo "{$indent}{$sniff} (line {$line}) reverted token {$stackPtr} ({$type}) \"{$oldContent}\" => \"{$newContent}\"" . PHP_EOL;
ob_start();
}
return true;
}