Skip to content

Commit

Permalink
Fix phpcbf crash in UnnecessaryNamespaceUsageSniff when class name is…
Browse files Browse the repository at this point in the history
… empty, fixes #212
  • Loading branch information
xalopp committed Dec 15, 2024
1 parent 036ac8a commit 2832a00
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2832a00

Please sign in to comment.