diff --git a/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php b/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php index 55415cd7..87f4feba 100644 --- a/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php +++ b/src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php @@ -410,7 +410,7 @@ private function processString(File $phpcsFile, int $stackPtr, string $namespace $error = '%s must be imported as %s'; $data = [$name, $alias]; - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'Import', $data); + $fix = $this->error($phpcsFile, $error, $stackPtr, 'Import', $data, $alias); if ($fix) { return $this->import($type, $name, $alias); @@ -460,7 +460,7 @@ private function error( string $code, array $data, string $expected - ) : void { + ) : bool { $fix = $phpcsFile->addFixableError($error, $stackPtr, $code, $data); if ($fix) { $tokens = $phpcsFile->getTokens(); @@ -481,6 +481,8 @@ private function error( } $phpcsFile->fixer->endChangeset(); } + + return $fix; } private function import(string $type, string $fqn, string $alias) : array