Browse Source

minor #6168 indexes -> indices (SpacePossum)

This PR was merged into the master branch.

Discussion
----------

indexes -> indices

Commits
-------

3c5c1971a indexes -> indices
SpacePossum 3 years ago
parent
commit
2c944f8c87

+ 1 - 1
src/AbstractDoctrineAnnotationFixer.php

@@ -47,7 +47,7 @@ abstract class AbstractDoctrineAnnotationFixer extends AbstractFixer implements
      */
     protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
     {
-        // fetch indexes one time, this is safe as we never add or remove a token during fixing
+        // fetch indices one time, this is safe as we never add or remove a token during fixing
         $analyzer = new TokensAnalyzer($tokens);
         $this->classyElements = $analyzer->getClassyElements();
 

+ 2 - 2
src/DocBlock/Line.php

@@ -102,7 +102,7 @@ final class Line
      * Remove this line by clearing its contents.
      *
      * Note that this method technically brakes the internal state of the
-     * docblock, but is useful when we need to retain the indexes of lines
+     * docblock, but is useful when we need to retain the indices of lines
      * during the execution of an algorithm.
      */
     public function remove(): void
@@ -114,7 +114,7 @@ final class Line
      * Append a blank docblock line to this line's contents.
      *
      * Note that this method technically brakes the internal state of the
-     * docblock, but is useful when we need to retain the indexes of lines
+     * docblock, but is useful when we need to retain the indices of lines
      * during the execution of an algorithm.
      */
     public function addBlank(): void

+ 1 - 1
src/Fixer/Alias/BacktickToShellExecFixer.php

@@ -102,7 +102,7 @@ EOT
      */
     private function fixBackticks(Tokens $tokens, array $backtickTokens): void
     {
-        // Track indexes for final override
+        // Track indices for final override
         ksort($backtickTokens);
         $openingBacktickIndex = key($backtickTokens);
         end($backtickTokens);

+ 1 - 1
src/Fixer/Alias/EregToPregFixer.php

@@ -97,7 +97,7 @@ final class EregToPregFixer extends AbstractFixer
                     break;
                 }
 
-                // findSequence also returns the tokens, but we're only interested in the indexes, i.e.:
+                // findSequence also returns the tokens, but we're only interested in the indices, i.e.:
                 // 0 => function name,
                 // 1 => bracket "("
                 // 2 => quoted string passed as 1st parameter

+ 5 - 5
src/Fixer/Alias/ModernizeStrposFixer.php

@@ -127,19 +127,19 @@ if (strpos($haystack, $needle) === false) {}
         }
     }
 
-    private function fixCall(Tokens $tokens, int $functionIndex, array $operatorIndexes): void
+    private function fixCall(Tokens $tokens, int $functionIndex, array $operatorIndices): void
     {
         foreach (self::REPLACEMENTS as $replacement) {
-            if (!$tokens[$operatorIndexes['operator_index']]->equals($replacement['operator'])) {
+            if (!$tokens[$operatorIndices['operator_index']]->equals($replacement['operator'])) {
                 continue;
             }
 
-            if (!$tokens[$operatorIndexes['operand_index']]->equals($replacement['operand'], false)) {
+            if (!$tokens[$operatorIndices['operand_index']]->equals($replacement['operand'], false)) {
                 continue;
             }
 
-            $tokens->clearTokenAndMergeSurroundingWhitespace($operatorIndexes['operator_index']);
-            $tokens->clearTokenAndMergeSurroundingWhitespace($operatorIndexes['operand_index']);
+            $tokens->clearTokenAndMergeSurroundingWhitespace($operatorIndices['operator_index']);
+            $tokens->clearTokenAndMergeSurroundingWhitespace($operatorIndices['operand_index']);
             $tokens->clearTokenAndMergeSurroundingWhitespace($functionIndex);
 
             if ($replacement['negate']) {

+ 1 - 1
src/Fixer/Alias/PowToExponentiationFixer.php

@@ -73,7 +73,7 @@ final class PowToExponentiationFixer extends AbstractFunctionReferenceFixer
 
         foreach (array_reverse($candidates) as $candidate) {
             // if in the previous iteration(s) tokens were added to the collection and this is done within the tokens
-            // indexes of the current candidate than the index of the close ')' of the candidate has moved and so
+            // indices of the current candidate than the index of the close ')' of the candidate has moved and so
             // the index needs to be updated
             if ($previousCloseParenthesisIndex < $candidate[2]) {
                 $previousCloseParenthesisIndex = $candidate[2];

+ 3 - 3
src/Fixer/ClassNotation/NoPhp4ConstructorFixer.php

@@ -221,7 +221,7 @@ class Foo
             ], $classStart, $classEnd, [2 => false]);
 
             if (null !== $parentSeq) {
-                // we only need indexes
+                // we only need indices
                 $parentSeq = array_keys($parentSeq);
 
                 // match either of the possibilities
@@ -242,7 +242,7 @@ class Foo
                 ], $classStart, $classEnd, [2 => false]);
 
                 if (null !== $parentSeq) {
-                    // we only need indexes
+                    // we only need indices
                     $parentSeq = array_keys($parentSeq);
 
                     // replace call with parent::__construct()
@@ -378,7 +378,7 @@ class Foo
             return null;
         }
 
-        // keep only the indexes
+        // keep only the indices
         $function = array_keys($function);
 
         // find previous block, saving method modifiers for later use

+ 4 - 4
src/Fixer/ClassNotation/SingleTraitInsertPerStatementFixer.php

@@ -70,7 +70,7 @@ final class Example
     }
 
     /**
-     * @param int[] $candidates ',' indexes to fix
+     * @param int[] $candidates ',' indices to fix
      */
     private function fixTraitUse(Tokens $tokens, int $useTraitIndex, array $candidates): void
     {
@@ -99,7 +99,7 @@ final class Example
      */
     private function getCandidates(Tokens $tokens, int $index): array
     {
-        $indexes = [];
+        $indices = [];
         $index = $tokens->getNextTokenOfKind($index, [',', ';', '{']);
 
         while (!$tokens[$index]->equals(';')) {
@@ -107,10 +107,10 @@ final class Example
                 return []; // do not fix use cases with grouping
             }
 
-            $indexes[] = $index;
+            $indices[] = $index;
             $index = $tokens->getNextTokenOfKind($index, [',', ';', '{']);
         }
 
-        return array_reverse($indexes);
+        return array_reverse($indices);
     }
 }

+ 4 - 4
src/Fixer/Comment/HeaderCommentFixer.php

@@ -141,19 +141,19 @@ echo 1;
     protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
     {
         $location = $this->configuration['location'];
-        $locationIndexes = [];
+        $locationIndices = [];
 
         foreach (['after_open', 'after_declare_strict'] as $possibleLocation) {
             $locationIndex = $this->findHeaderCommentInsertionIndex($tokens, $possibleLocation);
 
-            if (!isset($locationIndexes[$locationIndex]) || $possibleLocation === $location) {
-                $locationIndexes[$locationIndex] = $possibleLocation;
+            if (!isset($locationIndices[$locationIndex]) || $possibleLocation === $location) {
+                $locationIndices[$locationIndex] = $possibleLocation;
 
                 continue;
             }
         }
 
-        foreach (array_values($locationIndexes) as $possibleLocation) {
+        foreach (array_values($locationIndices) as $possibleLocation) {
             // figure out where the comment should be placed
             $headerNewIndex = $this->findHeaderCommentInsertionIndex($tokens, $possibleLocation);
 

+ 4 - 4
src/Fixer/ControlStructure/SimplifiedIfReturnFixer.php

@@ -119,11 +119,11 @@ final class SimplifiedIfReturnFixer extends AbstractFixer
                     continue;
                 }
 
-                $indexesToClear = array_keys($sequenceFound);
-                array_pop($indexesToClear); // Preserve last semicolon
-                rsort($indexesToClear);
+                $indicesToClear = array_keys($sequenceFound);
+                array_pop($indicesToClear); // Preserve last semicolon
+                rsort($indicesToClear);
 
-                foreach ($indexesToClear as $index) {
+                foreach ($indicesToClear as $index) {
                     $tokens->clearTokenAndMergeSurroundingWhitespace($index);
                 }
 

Some files were not shown because too many files changed in this diff