Browse Source

minor #5516 DX: AbstractDoctrineAnnotationFixer - no need for import aliases (keradus)

This PR was squashed before being merged into the 2.18 branch.

Discussion
----------

DX: AbstractDoctrineAnnotationFixer - no need for import aliases

Commits
-------

401dab195 DX: AbstractDoctrineAnnotationFixer - no need for import aliases
Dariusz Ruminski 4 years ago
parent
commit
c244b0730f
1 changed files with 12 additions and 12 deletions
  1. 12 12
      src/AbstractDoctrineAnnotationFixer.php

+ 12 - 12
src/AbstractDoctrineAnnotationFixer.php

@@ -17,8 +17,8 @@ use PhpCsFixer\Fixer\ConfigurationDefinitionFixerInterface;
 use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
 use PhpCsFixer\FixerConfiguration\FixerConfigurationResolver;
 use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
 use PhpCsFixer\FixerConfiguration\FixerOptionBuilder;
 use PhpCsFixer\Tokenizer\CT;
 use PhpCsFixer\Tokenizer\CT;
-use PhpCsFixer\Tokenizer\Token as PhpToken;
-use PhpCsFixer\Tokenizer\Tokens as PhpTokens;
+use PhpCsFixer\Tokenizer\Token;
+use PhpCsFixer\Tokenizer\Tokens;
 use PhpCsFixer\Tokenizer\TokensAnalyzer;
 use PhpCsFixer\Tokenizer\TokensAnalyzer;
 
 
 /**
 /**
@@ -34,7 +34,7 @@ abstract class AbstractDoctrineAnnotationFixer extends AbstractFixer implements
     /**
     /**
      * {@inheritdoc}
      * {@inheritdoc}
      */
      */
-    public function isCandidate(PhpTokens $tokens)
+    public function isCandidate(Tokens $tokens)
     {
     {
         return $tokens->isTokenKindFound(T_DOC_COMMENT);
         return $tokens->isTokenKindFound(T_DOC_COMMENT);
     }
     }
@@ -42,24 +42,24 @@ abstract class AbstractDoctrineAnnotationFixer extends AbstractFixer implements
     /**
     /**
      * {@inheritdoc}
      * {@inheritdoc}
      */
      */
-    protected function applyFix(\SplFileInfo $file, PhpTokens $phpTokens)
+    protected function applyFix(\SplFileInfo $file, Tokens $tokens)
     {
     {
         // fetch indexes one time, this is safe as we never add or remove a token during fixing
         // fetch indexes one time, this is safe as we never add or remove a token during fixing
-        $analyzer = new TokensAnalyzer($phpTokens);
+        $analyzer = new TokensAnalyzer($tokens);
         $this->classyElements = $analyzer->getClassyElements();
         $this->classyElements = $analyzer->getClassyElements();
 
 
-        /** @var PhpToken $docCommentToken */
-        foreach ($phpTokens->findGivenKind(T_DOC_COMMENT) as $index => $docCommentToken) {
-            if (!$this->nextElementAcceptsDoctrineAnnotations($phpTokens, $index)) {
+        /** @var Token $docCommentToken */
+        foreach ($tokens->findGivenKind(T_DOC_COMMENT) as $index => $docCommentToken) {
+            if (!$this->nextElementAcceptsDoctrineAnnotations($tokens, $index)) {
                 continue;
                 continue;
             }
             }
 
 
-            $tokens = DoctrineAnnotationTokens::createFromDocComment(
+            $doctrineAnnotationTokens = DoctrineAnnotationTokens::createFromDocComment(
                 $docCommentToken,
                 $docCommentToken,
                 $this->configuration['ignored_tags']
                 $this->configuration['ignored_tags']
             );
             );
-            $this->fixAnnotations($tokens);
-            $phpTokens[$index] = new PhpToken([T_DOC_COMMENT, $tokens->getCode()]);
+            $this->fixAnnotations($doctrineAnnotationTokens);
+            $tokens[$index] = new Token([T_DOC_COMMENT, $doctrineAnnotationTokens->getCode()]);
         }
         }
     }
     }
 
 
@@ -199,7 +199,7 @@ abstract class AbstractDoctrineAnnotationFixer extends AbstractFixer implements
      *
      *
      * @return bool
      * @return bool
      */
      */
-    private function nextElementAcceptsDoctrineAnnotations(PhpTokens $tokens, $index)
+    private function nextElementAcceptsDoctrineAnnotations(Tokens $tokens, $index)
     {
     {
         do {
         do {
             $index = $tokens->getNextMeaningfulToken($index);
             $index = $tokens->getNextMeaningfulToken($index);