Updated Rector to commit aac889be3d845974d3ab924ff7ad22784b9e3cb5

aac889be3d [AutoImport] Remove unused compare removed use on FullyQualifiedNameClassNameImportSkipVoter (#5764)
This commit is contained in:
Tomas Votruba 2024-03-23 16:49:42 +00:00
parent bb8b99d70c
commit e14c8a528b
2 changed files with 4 additions and 15 deletions

View File

@ -7,7 +7,6 @@ use RectorPrefix202403\Nette\Utils\Strings;
use PhpParser\Node; use PhpParser\Node;
use Rector\CodingStyle\ClassNameImport\ShortNameResolver; use Rector\CodingStyle\ClassNameImport\ShortNameResolver;
use Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface; use Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface;
use Rector\Configuration\RenamedClassesDataCollector;
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType; use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
use Rector\ValueObject\Application\File; use Rector\ValueObject\Application\File;
/** /**
@ -26,15 +25,9 @@ final class FullyQualifiedNameClassNameImportSkipVoter implements ClassNameImpor
* @var \Rector\CodingStyle\ClassNameImport\ShortNameResolver * @var \Rector\CodingStyle\ClassNameImport\ShortNameResolver
*/ */
private $shortNameResolver; private $shortNameResolver;
/** public function __construct(ShortNameResolver $shortNameResolver)
* @readonly
* @var \Rector\Configuration\RenamedClassesDataCollector
*/
private $renamedClassesDataCollector;
public function __construct(ShortNameResolver $shortNameResolver, RenamedClassesDataCollector $renamedClassesDataCollector)
{ {
$this->shortNameResolver = $shortNameResolver; $this->shortNameResolver = $shortNameResolver;
$this->renamedClassesDataCollector = $renamedClassesDataCollector;
} }
public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedObjectType, Node $node) : bool public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedObjectType, Node $node) : bool
{ {
@ -43,7 +36,6 @@ final class FullyQualifiedNameClassNameImportSkipVoter implements ClassNameImpor
$shortNamesToFullyQualifiedNames = $this->shortNameResolver->resolveFromFile($file); $shortNamesToFullyQualifiedNames = $this->shortNameResolver->resolveFromFile($file);
$fullyQualifiedObjectTypeShortName = $fullyQualifiedObjectType->getShortName(); $fullyQualifiedObjectTypeShortName = $fullyQualifiedObjectType->getShortName();
$className = $fullyQualifiedObjectType->getClassName(); $className = $fullyQualifiedObjectType->getClassName();
$removedUses = $this->renamedClassesDataCollector->getOldClasses();
foreach ($shortNamesToFullyQualifiedNames as $shortName => $fullyQualifiedName) { foreach ($shortNamesToFullyQualifiedNames as $shortName => $fullyQualifiedName) {
if ($fullyQualifiedObjectTypeShortName !== $shortName) { if ($fullyQualifiedObjectTypeShortName !== $shortName) {
$shortName = $this->cleanShortName($shortName); $shortName = $this->cleanShortName($shortName);
@ -52,10 +44,7 @@ final class FullyQualifiedNameClassNameImportSkipVoter implements ClassNameImpor
continue; continue;
} }
$fullyQualifiedName = \ltrim($fullyQualifiedName, '\\'); $fullyQualifiedName = \ltrim($fullyQualifiedName, '\\');
if ($className === $fullyQualifiedName) { return $className !== $fullyQualifiedName;
return \false;
}
return !\in_array($fullyQualifiedName, $removedUses, \true);
} }
return \false; return \false;
} }

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'e3e741edd3ca55fc2c24c040f43c8974bda7e953'; public const PACKAGE_VERSION = 'aac889be3d845974d3ab924ff7ad22784b9e3cb5';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-03-23 21:34:02'; public const RELEASE_DATE = '2024-03-23 23:47:25';
/** /**
* @var int * @var int
*/ */