Skip to content

Commit

Permalink
Updated Rector to commit 6f863d1552d270c2df41742ffcd87e2168d135b5
Browse files Browse the repository at this point in the history
rectorphp/rector-src@6f863d1 [PostRector] Reduce repetitive toString() on loop on UnusedImportRemovingPostRector (#6379)
  • Loading branch information
TomasVotruba committed Oct 12, 2024
1 parent 6ba528b commit b862c5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '6e936f73472d31e5d93da3b3a4fbe2c78b4fbf5a';
public const PACKAGE_VERSION = '6f863d1552d270c2df41742ffcd87e2168d135b5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-10-12 20:33:28';
public const RELEASE_DATE = '2024-10-12 20:45:54';
/**
* @var int
*/
Expand Down
4 changes: 2 additions & 2 deletions src/PostRector/Rector/UnusedImportRemovingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function enterNode(Node $node) : ?Node
return null;
}
$hasChanged = \false;
$namespaceOriginalName = $node instanceof Namespace_ && $node->name instanceof Name ? $node->name : null;
$namespaceOriginalCase = $node instanceof Namespace_ && $node->name instanceof Name ? $node->name->toString() : null;
$namesInOriginalCase = $this->resolveUsedPhpAndDocNames($node);
$namesInLowerCase = \array_map(\Closure::fromCallable('strtolower'), $namesInOriginalCase);
foreach ($node->stmts as $key => $stmt) {
Expand All @@ -55,7 +55,7 @@ public function enterNode(Node $node) : ?Node
}
$isCaseSensitive = $stmt->type === Use_::TYPE_CONSTANT;
$names = $isCaseSensitive ? $namesInOriginalCase : $namesInLowerCase;
$namespaceName = $namespaceOriginalName instanceof Name ? $isCaseSensitive ? $namespaceOriginalName->toString() : \strtolower($namespaceOriginalName->toString()) : null;
$namespaceName = $namespaceOriginalCase === null ? null : ($isCaseSensitive ? $namespaceOriginalCase : \strtolower($namespaceOriginalCase));
foreach ($stmt->uses as $useUseKey => $useUse) {
if ($this->isUseImportUsed($useUse, $isCaseSensitive, $names, $namespaceName)) {
continue;
Expand Down

0 comments on commit b862c5c

Please sign in to comment.