Skip to content

Commit 4f4d47e

Browse files
committed
lol
1 parent 40b27bd commit 4f4d47e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class UnnecessaryNamespaceUsageSniff implements Sniff
4848
T_NAME_FULLY_QUALIFIED,
4949
T_NAME_QUALIFIED,
5050
T_NAME_RELATIVE,
51-
T_NS_SEPARATOR,
52-
T_STRING,
5351
];
5452

5553
/**
@@ -91,7 +89,9 @@ public function process(File $phpcsFile, $stackPtr): void
9189
'@var' => 2,
9290
];
9391
$scanTokens = [
94-
T_NS_SEPARATOR,
92+
T_NAME_FULLY_QUALIFIED,
93+
T_NAME_QUALIFIED,
94+
T_NAME_RELATIVE,
9595
T_DOC_COMMENT_OPEN_TAG,
9696
];
9797

@@ -109,10 +109,7 @@ public function process(File $phpcsFile, $stackPtr): void
109109
true
110110
);
111111

112-
if (T_NS_SEPARATOR === $tokens[$nsSep]['code']) {
113-
if (T_STRING === $tokens[($nsSep - 1)]['code']) {
114-
--$nsSep;
115-
}
112+
if (\in_array($tokens[$nsSep]['code'], [T_NAME_FULLY_QUALIFIED, T_NAME_QUALIFIED, T_NAME_RELATIVE], true)) {
116113

117114
$className = $phpcsFile->getTokensAsString(
118115
$nsSep,
@@ -378,6 +375,7 @@ private function checkShorthandPossible(File $phpcsFile, array $useStatements, s
378375
$className,
379376
$replacement,
380377
];
378+
381379
$fixable = $phpcsFile->addFixableWarning(
382380
$msg,
383381
$startPtr,

0 commit comments

Comments
 (0)