diff --git a/rules/Renaming/NodeManipulator/ClassRenamer.php b/rules/Renaming/NodeManipulator/ClassRenamer.php index f8fe1b477d3..c7f1296b80e 100644 --- a/rules/Renaming/NodeManipulator/ClassRenamer.php +++ b/rules/Renaming/NodeManipulator/ClassRenamer.php @@ -153,13 +153,6 @@ private function refactorName(FullyQualified $fullyQualified, array $oldToNewCla return null; } - // no need to preslash "use \SomeNamespace" of imported namespace - if ($fullyQualified->getAttribute(AttributeKey::IS_USEUSE_NAME) === true) { - // no need to rename imports, they will be handled by autoimport and coding standard - // also they might cause some rename - return null; - } - if ($this->shouldSkip($newName, $fullyQualified)) { return null; } diff --git a/src/NodeTypeResolver/Node/AttributeKey.php b/src/NodeTypeResolver/Node/AttributeKey.php index e6e59250fd8..022c6b0f793 100644 --- a/src/NodeTypeResolver/Node/AttributeKey.php +++ b/src/NodeTypeResolver/Node/AttributeKey.php @@ -247,11 +247,6 @@ final class AttributeKey */ public const IS_ARRAY_IN_ATTRIBUTE = 'is_array_in_attribute'; - /** - * @var string - */ - public const IS_USEUSE_NAME = 'is_useuse_name'; - /** * @var string */ diff --git a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php index eff9e4ee920..cd5461a87cd 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php +++ b/src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/NameNodeVisitor.php @@ -10,8 +10,6 @@ use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Name; -use PhpParser\Node\Stmt\Use_; -use PhpParser\Node\Stmt\UseUse; use PhpParser\NodeVisitorAbstract; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface; @@ -20,11 +18,6 @@ final class NameNodeVisitor extends NodeVisitorAbstract implements ScopeResolver { public function enterNode(Node $node): ?Node { - if ($node instanceof UseUse && ($node->type === Use_::TYPE_NORMAL || $node->type === Use_::TYPE_UNKNOWN)) { - $node->name->setAttribute(AttributeKey::IS_USEUSE_NAME, true); - return null; - } - if ($node instanceof FuncCall && $node->name instanceof Name) { $node->name->setAttribute(AttributeKey::IS_FUNCCALL_NAME, true); return null; diff --git a/src/PhpParser/Printer/BetterStandardPrinter.php b/src/PhpParser/Printer/BetterStandardPrinter.php index 3f4cdbf86b5..3cdc3cba377 100644 --- a/src/PhpParser/Printer/BetterStandardPrinter.php +++ b/src/PhpParser/Printer/BetterStandardPrinter.php @@ -13,8 +13,6 @@ use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Ternary; use PhpParser\Node\Expr\Yield_; -use PhpParser\Node\Name; -use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Param; use PhpParser\Node\Scalar\DNumber; use PhpParser\Node\Scalar\EncapsedStringPart; @@ -24,7 +22,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Declare_; use PhpParser\Node\Stmt\Nop; -use PhpParser\Node\Stmt\Use_; use PhpParser\PrettyPrinter\Standard; use PHPStan\Node\Expr\AlwaysRememberedExpr; use Rector\Configuration\Option; @@ -392,26 +389,6 @@ protected function pExpr_Ternary(Ternary $ternary): string return parent::pExpr_Ternary($ternary); } - /** - * Remove extra \\ from FQN use imports, for easier use in the code - */ - protected function pStmt_Use(Use_ $use): string - { - if ($use->type !== Use_::TYPE_NORMAL) { - return parent::pStmt_Use($use); - } - - foreach ($use->uses as $useUse) { - if (! $useUse->name instanceof FullyQualified) { - continue; - } - - $useUse->name = new Name($useUse->name->toString()); - } - - return parent::pStmt_Use($use); - } - protected function pScalar_EncapsedStringPart(EncapsedStringPart $encapsedStringPart): string { // parent throws exception, but we need to compare string diff --git a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php index b0d2783fff6..43db69006b3 100644 --- a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php @@ -10,7 +10,6 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeWithClassName; -use Rector\NodeTypeResolver\Node\AttributeKey; /** * @api @@ -35,7 +34,6 @@ public function getFullyQualifiedName(): string public function getUseNode(int $useType): Use_ { $name = new Name($this->fullyQualifiedClass); - $name->setAttribute(AttributeKey::IS_USEUSE_NAME, true); $useUse = new UseUse($name, $this->getClassName()); diff --git a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php index eb91939d4f4..36298867217 100644 --- a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php @@ -54,8 +54,6 @@ public function getShortNameNode(): Name public function getUseNode(int $useType): Use_ { $name = new Name($this->getClassName()); - $name->setAttribute(AttributeKey::IS_USEUSE_NAME, true); - $useUse = new UseUse($name); $use = new Use_([$useUse]);