diff --git a/packages/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php b/packages/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php index ff430880f23..0a243c350ee 100644 --- a/packages/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php +++ b/packages/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php @@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\UseUse; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; use PHPStan\Type\TypeWithClassName; +use Rector\NodeTypeResolver\Node\AttributeKey; /** * @api */ @@ -31,6 +32,7 @@ final class AliasedObjectType extends ObjectType public function getUseNode() : Use_ { $name = new Name($this->fullyQualifiedClass); + $name->setAttribute(AttributeKey::IS_USEUSE_NAME, \true); $useUse = new UseUse($name, $this->getClassName()); return new Use_([$useUse]); } @@ -48,6 +50,7 @@ final class AliasedObjectType extends ObjectType public function getFunctionUseNode() : Use_ { $name = new Name($this->fullyQualifiedClass); + $name->setAttribute(AttributeKey::IS_USEUSE_NAME, \true); $useUse = new UseUse($name, $this->getClassName()); $use = new Use_([$useUse]); $use->type = Use_::TYPE_FUNCTION; diff --git a/packages/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php b/packages/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php index 3df35c4af68..364c6a9cf89 100644 --- a/packages/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php +++ b/packages/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php @@ -45,15 +45,15 @@ final class FullyQualifiedObjectType extends ObjectType public function getUseNode() : Use_ { $name = new Name($this->getClassName()); + $name->setAttribute(AttributeKey::IS_USEUSE_NAME, \true); $useUse = new UseUse($name); - $name->setAttribute(AttributeKey::PARENT_NODE, $useUse); return new Use_([$useUse]); } public function getFunctionUseNode() : Use_ { $name = new Name($this->getClassName()); + $name->setAttribute(AttributeKey::IS_USEUSE_NAME, \true); $useUse = new UseUse($name, null); - $name->setAttribute(AttributeKey::PARENT_NODE, $useUse); $use = new Use_([$useUse]); $use->type = Use_::TYPE_FUNCTION; return $use; diff --git a/rules/CodingStyle/Node/NameImporter.php b/rules/CodingStyle/Node/NameImporter.php index d0997917b77..3145230eca2 100644 --- a/rules/CodingStyle/Node/NameImporter.php +++ b/rules/CodingStyle/Node/NameImporter.php @@ -4,7 +4,6 @@ declare (strict_types=1); namespace Rector\CodingStyle\Node; use PhpParser\Node\Name; -use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\GroupUse; use PhpParser\Node\Stmt\Use_; use Rector\CodingStyle\ClassNameImport\AliasUsesResolver; @@ -133,10 +132,7 @@ final class NameImporter if ($name->getAttribute(AttributeKey::IS_NAMESPACE_NAME) === \true) { return \true; } - if ($name->getAttribute(AttributeKey::IS_USEUSE_NAME) === \true) { - return \true; - } - return !$name instanceof FullyQualified; + return $name->getAttribute(AttributeKey::IS_USEUSE_NAME) === \true; } private function isFunctionOrConstantImportWithSingleName(Name $name) : bool { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 24a7529bc11..e0192caf966 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 = 'beca17df3f02d9a2a7800e9b238bac3b9c862498'; + public const PACKAGE_VERSION = '6cc42eb33187a9b77357c1f459d724c8aa1eb4f7'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-06-25 23:48:32'; + public const RELEASE_DATE = '2023-06-26 00:02:05'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index ac46ee139d6..79ec120f142 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) { require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit6c9499dd0d9c07b7ba7975b1e0a97662::getLoader(); +return ComposerAutoloaderInit63c0cd1f8e04b29f96bbff647001340d::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 18294a9ebd1..3127c7398b5 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit6c9499dd0d9c07b7ba7975b1e0a97662 +class ComposerAutoloaderInit63c0cd1f8e04b29f96bbff647001340d { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit6c9499dd0d9c07b7ba7975b1e0a97662 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit6c9499dd0d9c07b7ba7975b1e0a97662', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit63c0cd1f8e04b29f96bbff647001340d', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit6c9499dd0d9c07b7ba7975b1e0a97662', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit63c0cd1f8e04b29f96bbff647001340d', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d::$files; $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 12d304c9606..00a56e115ae 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662 +class ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3091,9 +3091,9 @@ class ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit6c9499dd0d9c07b7ba7975b1e0a97662::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit63c0cd1f8e04b29f96bbff647001340d::$classMap; }, null, ClassLoader::class); }