From 6ce5f37b288fddd4767fd21cfe2413248c942130 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 23 Jul 2023 16:14:28 +0000 Subject: [PATCH] Updated Rector to commit 2afa47cd68086b61cb2363bcfb5553eb8767b50c https://github.com/rectorphp/rector-src/commit/2afa47cd68086b61cb2363bcfb5553eb8767b50c [StaticTypeMapper] Remove standalone false handling on StaticTypeMapper (#4582) --- .../StaticTypeMapper/StaticTypeMapper.php | 32 ++----------------- src/Application/VersionResolver.php | 4 +-- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 +++--- vendor/composer/autoload_static.php | 8 ++--- 5 files changed, 14 insertions(+), 42 deletions(-) diff --git a/packages/StaticTypeMapper/StaticTypeMapper.php b/packages/StaticTypeMapper/StaticTypeMapper.php index 49b60fd05099..dfb90bb8a204 100644 --- a/packages/StaticTypeMapper/StaticTypeMapper.php +++ b/packages/StaticTypeMapper/StaticTypeMapper.php @@ -7,7 +7,6 @@ use PhpParser\Node\ComplexType; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\UnionType; use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode; use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; @@ -18,7 +17,6 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; use Rector\Core\Exception\NotImplementedYetException; -use Rector\NodeNameResolver\NodeNameResolver; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper; use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper; @@ -50,22 +48,12 @@ final class StaticTypeMapper * @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper */ private $phpParserNodeMapper; - /** - * @readonly - * @var \Rector\NodeNameResolver\NodeNameResolver - */ - private $nodeNameResolver; - /** - * @var array - */ - private const STANDALONE_MAPS = ['false' => 'bool']; - public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper, NodeNameResolver $nodeNameResolver) + public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper) { $this->nameScopeFactory = $nameScopeFactory; $this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper; $this->phpDocTypeMapper = $phpDocTypeMapper; $this->phpParserNodeMapper = $phpParserNodeMapper; - $this->nodeNameResolver = $nodeNameResolver; } public function mapPHPStanTypeToPHPStanPhpDocTypeNode(Type $phpStanType) : TypeNode { @@ -77,23 +65,7 @@ public function mapPHPStanTypeToPHPStanPhpDocTypeNode(Type $phpStanType) : TypeN */ public function mapPHPStanTypeToPhpParserNode(Type $phpStanType, string $typeKind) : ?Node { - $node = $this->phpStanStaticTypeMapper->mapToPhpParserNode($phpStanType, $typeKind); - if (!$node instanceof Node) { - return null; - } - if ($node instanceof UnionType) { - return $node; - } - if (!$node instanceof Name) { - return $node; - } - $nodeName = $this->nodeNameResolver->getName($node); - foreach (self::STANDALONE_MAPS as $key => $type) { - if ($nodeName === $key) { - return new Name($type); - } - } - return $node; + return $this->phpStanStaticTypeMapper->mapToPhpParserNode($phpStanType, $typeKind); } public function mapPhpParserNodePHPStanType(Node $node) : Type { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index dc68ae10afab..34e0dc57b60f 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 = '07934c889213adc8a63a4db60b23575440da30c9'; + public const PACKAGE_VERSION = '2afa47cd68086b61cb2363bcfb5553eb8767b50c'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-07-23 17:09:53'; + public const RELEASE_DATE = '2023-07-23 17:10:16'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 71a11c5c0b96..b440787a2d96 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00::getLoader(); +return ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index da90c2bfadc9..9d0c4f6acd6a 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00 +class ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit5ca5cf93238327764a56963c242c2c00::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit824bd8621e72888629f212d328a62f9a::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInit824bd8621e72888629f212d328a62f9a::$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 8ecfc4cd2309..edcf544c7d51 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit5ca5cf93238327764a56963c242c2c00 +class ComposerStaticInit824bd8621e72888629f212d328a62f9a { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -3022,9 +3022,9 @@ class ComposerStaticInit5ca5cf93238327764a56963c242c2c00 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$classMap; }, null, ClassLoader::class); }