mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-21 02:23:09 +00:00
Updated Rector to commit a2ff229df99785b6b51721d929a750f51e72f57a
a2ff229df9
Fix phpstan (#5489)
This commit is contained in:
parent
b140c86242
commit
0fc99839e2
|
@ -148,7 +148,26 @@ final class ClassRenamer
|
||||||
private function refactorClassLike(ClassLike $classLike, array $oldToNewClasses, ?Scope $scope) : ?Node
|
private function refactorClassLike(ClassLike $classLike, array $oldToNewClasses, ?Scope $scope) : ?Node
|
||||||
{
|
{
|
||||||
// rename interfaces
|
// 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 $classLike;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -180,32 +199,6 @@ final class ClassRenamer
|
||||||
}
|
}
|
||||||
return \false;
|
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
|
private function isValidClassNameChange(FullyQualified $fullyQualified, ClassReflection $classReflection) : bool
|
||||||
{
|
{
|
||||||
if ($fullyQualified->getAttribute(AttributeKey::IS_CLASS_EXTENDS) === \true) {
|
if ($fullyQualified->getAttribute(AttributeKey::IS_CLASS_EXTENDS) === \true) {
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '46dd96122bdeb7b893f518bd131c69093b6da752';
|
public const PACKAGE_VERSION = 'a2ff229df99785b6b51721d929a750f51e72f57a';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-01-22 06:13:21';
|
public const RELEASE_DATE = '2024-01-21 23:19:40';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user