Skip to content

Commit

Permalink
Update src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
Browse files Browse the repository at this point in the history
Co-authored-by: Greg Korba <wirone@gmail.com>
  • Loading branch information
mvorisek and Wirone committed Jan 9, 2024
1 parent b58bdc7 commit 94fe204
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Fixer/Import/FullyQualifiedStrictTypesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,14 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void

for ($index = $namespace->getScopeStartIndex(); $index < $namespace->getScopeEndIndex() + $indexDiff; ++$index) {
$origSize = \count($tokens);
if ($discoverSymbolsPhase && $tokens[$index]->isGivenKind([T_CLASS, T_INTERFACE, T_TRAIT])) {
$classyKinds = [T_CLASS, T_INTERFACE, T_TRAIT];

if (\defined('T_ENUM')) { // @TODO: drop condition when PHP 8.1+ is required
$classyKinds[] = T_ENUM;
}

if ($discoverSymbolsPhase && $tokens[$index]->isGivenKind($classyKinds)) {
// We actually don't fix anything here, but run symbols collecting logic
$this->fixNextName($tokens, $index, $uses, $namespaceName);
} elseif ($tokens[$index]->isGivenKind(T_FUNCTION)) {
$this->fixFunction($functionsAnalyzer, $tokens, $index, $uses, $namespaceName);
Expand Down

0 comments on commit 94fe204

Please sign in to comment.