diff --git a/rules/CodingStyle/Application/UseImportsRemover.php b/rules/CodingStyle/Application/UseImportsRemover.php index 075900ea376..bb3a83ffb1c 100644 --- a/rules/CodingStyle/Application/UseImportsRemover.php +++ b/rules/CodingStyle/Application/UseImportsRemover.php @@ -3,6 +3,7 @@ declare (strict_types=1); namespace Rector\CodingStyle\Application; +use RectorPrefix202310\Nette\Utils\Strings; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Use_; use Rector\PostRector\Collector\UseNodesToAddCollector; @@ -54,14 +55,14 @@ final class UseImportsRemover if (!\in_array($useName, $removedUses, \true)) { continue; } + $lastUseName = Strings::after($useName, '\\', -1); foreach ($useImportTypes as $useImportType) { $className = $useImportType instanceof AliasedObjectType ? $useImportType->getFullyQualifiedName() : $useImportType->getClassName(); - if ($className === $useName) { + if ($className === $useName || Strings::after($className, '\\', -1) === $lastUseName) { unset($use->uses[$usesKey]); continue 2; } } - unset($use->uses[$usesKey]); } return $use; } diff --git a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php index 8ef7aaea897..ae7e9dcc2c2 100644 --- a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php +++ b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php @@ -3,9 +3,9 @@ declare (strict_types=1); namespace Rector\DeadCode\Rector\If_; -use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node; use PhpParser\Node\Expr; +use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\BinaryOp\BooleanAnd; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 0984af603fd..b76fabd1326 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 = '29370c7ddfc45c6fe29d88cfca6aa56234a76874'; + public const PACKAGE_VERSION = 'c5d3a0e1913fb0057513dd70122d8eef4d226e1c'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-10-15 10:36:28'; + public const RELEASE_DATE = '2023-10-15 11:03:12'; /** * @var int */