Updated Rector to commit a2ff229df99785b6b51721d929a750f51e72f57a

a2ff229df9 Fix phpstan (#5489)
This commit is contained in:
Tomas Votruba 2024-01-21 23:21:57 +00:00
parent b140c86242
commit 0fc99839e2
2 changed files with 22 additions and 29 deletions

View File

@ -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) {

View File

@ -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
*/