Skip to content

Commit bd5c32d

Browse files
authored
NoImportFromGlobalNamespaceFixer - fix for using trait (#231)
1 parent 401eb2f commit bd5c32d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Fixer/NoImportFromGlobalNamespaceFixer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
1010
use PhpCsFixer\Preg;
1111
use PhpCsFixer\Tokenizer\Analyzer\NamespacesAnalyzer;
12-
use PhpCsFixer\Tokenizer\CT;
1312
use PhpCsFixer\Tokenizer\Token;
1413
use PhpCsFixer\Tokenizer\Tokens;
1514
use PhpCsFixerCustomFixers\TokenRemover;
@@ -134,7 +133,7 @@ private function updateUsage(Tokens $tokens, array $imports, int $index): void
134133
}
135134

136135
$prevIndex = $tokens->getPrevMeaningfulToken($index);
137-
if ($tokens[$prevIndex]->isGivenKind([T_CONST, T_DOUBLE_COLON, T_NS_SEPARATOR, T_OBJECT_OPERATOR, CT::T_USE_TRAIT])) {
136+
if ($tokens[$prevIndex]->isGivenKind([T_CONST, T_DOUBLE_COLON, T_NS_SEPARATOR, T_OBJECT_OPERATOR])) {
138137
return;
139138
}
140139

tests/Fixer/NoImportFromGlobalNamespaceFixerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(\DateTime $dateTime) {}
104104
'<?php
105105
namespace Foo;
106106
class Baz {
107-
use DateTime;
107+
use \DateTime;
108108
public function __construct() {}
109109
}
110110
',

0 commit comments

Comments
 (0)