When I call addFixableError in phpcs the output shows a fixable error as expected, however in the sniff code I check the return and this is false and I would therefore expect the output from phpcs to show that the error is not fixable.
I am correct in this assumptino or am I missing something?
It seems that phpcs_file->fixer->enabled is false
how do i correctly set this value?
sniff code -
$phpcs_file->fixer->beginChangeset();
$fix = $phpcs_file->addFixableError ($error, $stack_ptr, 'FunctionNameInvalid', $data);
if ($fix === true) {
$token = $tokens[$stack_ptr +2];
$token['content'] = $snake_case_string;
if ($phpcs_file->fixer->replaceToken ($stack_ptr, "asasd") === false) {
print("could not replace\n");
}
} else {
print("could not fix\n");
}
The root of my confusion came from the fact that when phpcs creates a diff it uses the ob_start command so I was not seeing any of my outpu – GrahamL Jun 12 '17 at 08:07