|
@@ -169,22 +169,18 @@ final class NativeFunctionTypeDeclarationCasingFixer extends AbstractFixer
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $argumentStartIndex = $type->getStartIndex();
|
|
|
- $argumentExpectedEndIndex = $type->isNullable()
|
|
|
- ? $tokens->getNextMeaningfulToken($argumentStartIndex)
|
|
|
- : $argumentStartIndex
|
|
|
- ;
|
|
|
-
|
|
|
- if ($argumentExpectedEndIndex !== $type->getEndIndex()) {
|
|
|
- return; // the type to fix is always unqualified and so is always composed of one token and possible a nullable '?' one
|
|
|
- }
|
|
|
+ for ($index = $type->getStartIndex(); $index <= $type->getEndIndex(); ++$index) {
|
|
|
+ if ($tokens[$tokens->getNextMeaningfulToken($index)]->isGivenKind(T_NS_SEPARATOR)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- $lowerCasedName = strtolower($type->getName());
|
|
|
+ $lowerCasedName = strtolower($tokens[$index]->getContent());
|
|
|
|
|
|
- if (!isset($this->hints[$lowerCasedName])) {
|
|
|
- return; // check of type is of interest based on name (slower check than previous index based)
|
|
|
- }
|
|
|
+ if (!isset($this->hints[$lowerCasedName])) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- $tokens[$argumentExpectedEndIndex] = new Token([$tokens[$argumentExpectedEndIndex]->getId(), $lowerCasedName]);
|
|
|
+ $tokens[$index] = new Token([$tokens[$index]->getId(), $lowerCasedName]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|