diff --git a/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php b/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php index 18b9d0f9..6b8df420 100644 --- a/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php +++ b/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php @@ -230,7 +230,12 @@ protected function getUseStatements(File $phpcsFile, int $start, int $end): arra $end, true ); - $useEnd = $phpcsFile->findNext( + + if (0 === $classNameEnd) { + break; + } + + $useEnd = $phpcsFile->findNext( [ T_SEMICOLON, T_COMMA,