From 0fc99839e2c521dbab5421c04f7ef52eb29d69b6 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 21 Jan 2024 23:21:57 +0000 Subject: [PATCH] Updated Rector to commit a2ff229df99785b6b51721d929a750f51e72f57a https://github.com/rectorphp/rector-src/commit/a2ff229df99785b6b51721d929a750f51e72f57a Fix phpstan (#5489) --- .../Renaming/NodeManipulator/ClassRenamer.php | 47 ++++++++----------- src/Application/VersionResolver.php | 4 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/rules/Renaming/NodeManipulator/ClassRenamer.php b/rules/Renaming/NodeManipulator/ClassRenamer.php index 8308bd80b2a..bf6274cb5ba 100644 --- a/rules/Renaming/NodeManipulator/ClassRenamer.php +++ b/rules/Renaming/NodeManipulator/ClassRenamer.php @@ -148,7 +148,26 @@ final class ClassRenamer private function refactorClassLike(ClassLike $classLike, array $oldToNewClasses, ?Scope $scope) : ?Node { // rename interfaces - if ($this->renameClassImplements($classLike, $oldToNewClasses, $scope)) { + if (!$classLike instanceof Class_) { + return null; + } + $hasChanged = \false; + $classLike->implements = \array_unique($classLike->implements); + foreach ($classLike->implements as $key => $implementName) { + $virtualNode = (bool) $implementName->getAttribute(AttributeKey::VIRTUAL_NODE); + if (!$virtualNode) { + continue; + } + $namespaceName = $scope instanceof Scope ? $scope->getNamespace() : null; + $fullyQualifiedName = $namespaceName . '\\' . $implementName->toString(); + $newName = $oldToNewClasses[$fullyQualifiedName] ?? null; + if ($newName === null) { + continue; + } + $classLike->implements[$key] = new FullyQualified($newName); + $hasChanged = \true; + } + if ($hasChanged) { return $classLike; } return null; @@ -180,32 +199,6 @@ final class ClassRenamer } return \false; } - /** - * @param string[] $oldToNewClasses - */ - private function renameClassImplements(ClassLike $classLike, array $oldToNewClasses, ?Scope $scope) : bool - { - if (!$classLike instanceof Class_) { - return \false; - } - $hasChanged = \false; - $classLike->implements = \array_unique($classLike->implements); - foreach ($classLike->implements as $key => $implementName) { - $virtualNode = (bool) $implementName->getAttribute(AttributeKey::VIRTUAL_NODE); - if (!$virtualNode) { - continue; - } - $namespaceName = $scope instanceof Scope ? $scope->getNamespace() : null; - $fullyQualifiedName = $namespaceName . '\\' . $implementName->toString(); - $newName = $oldToNewClasses[$fullyQualifiedName] ?? null; - if ($newName === null) { - continue; - } - $classLike->implements[$key] = new FullyQualified($newName); - $hasChanged = \true; - } - return $hasChanged; - } private function isValidClassNameChange(FullyQualified $fullyQualified, ClassReflection $classReflection) : bool { if ($fullyQualified->getAttribute(AttributeKey::IS_CLASS_EXTENDS) === \true) { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 230e8912cfd..9a161165a8f 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '46dd96122bdeb7b893f518bd131c69093b6da752'; + public const PACKAGE_VERSION = 'a2ff229df99785b6b51721d929a750f51e72f57a'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-01-22 06:13:21'; + public const RELEASE_DATE = '2024-01-21 23:19:40'; /** * @var int */