Skip to content

Commit

Permalink
Revert "Fix UnusedImportRemovingPostRector for different letter case (#…
Browse files Browse the repository at this point in the history
…6350)" (#6354)

This reverts commit 447afc1.
  • Loading branch information
samsonasik authored Oct 5, 2024
1 parent 5fc55ce commit 330fda9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
12 changes: 6 additions & 6 deletions src/PostRector/Rector/UnusedImportRemovingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,17 @@ private function resolveUsedPhpAndDocNames(Namespace_|FileWithoutNamespace $name
$docBlockNames = $this->findNamesInDocBlocks($namespace);

$names = [...$phpNames, ...$docBlockNames];
return array_unique(array_map(strtolower(...), $names));
return array_unique($names);
}

/**
* @param string[] $names
* @param string[] $names
*/
private function isUseImportUsed(UseUse $useUse, array $names, ?Name $namespaceName): bool
{
$comparedName = strtolower($useUse->alias instanceof Identifier
$comparedName = $useUse->alias instanceof Identifier
? $useUse->alias->toString()
: $useUse->name->toString());
: $useUse->name->toString();

if (in_array($comparedName, $names, true)) {
return true;
Expand All @@ -181,8 +181,8 @@ private function isUseImportUsed(UseUse $useUse, array $names, ?Name $namespaceN
$namespacedPrefix = $comparedName . '\\';
}

$lastName = strtolower($useUse->name->getLast());
$namespaceName = $namespaceName instanceof Name ? strtolower($namespaceName->toString()) : null;
$lastName = $useUse->name->getLast();
$namespaceName = $namespaceName instanceof Name ? $namespaceName->toString() : null;

// match partial import
foreach ($names as $name) {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 330fda9

Please sign in to comment.