From 867dc4426c7c7551ca9666b3320b571f6e631115 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 14 Aug 2023 06:41:08 +0000 Subject: [PATCH] Updated Rector to commit 6b7aac835934de48c034aa8b2bad886616566e06 https://github.com/rectorphp/rector-src/commit/6b7aac835934de48c034aa8b2bad886616566e06 [Php81] Remove IntersectionTypesRector as rely on docblock (#4784) --- config/set/php81.php | 3 +- docs/rector_rules_overview.md | 25 +--- .../FunctionLike/IntersectionTypesRector.php | 119 ------------------ src/Application/VersionResolver.php | 4 +- vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_real.php | 10 +- vendor/composer/autoload_static.php | 9 +- 8 files changed, 15 insertions(+), 158 deletions(-) delete mode 100644 rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php diff --git a/config/set/php81.php b/config/set/php81.php index 2e974c48d0f..5a224b89de5 100644 --- a/config/set/php81.php +++ b/config/set/php81.php @@ -10,11 +10,10 @@ use Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector; use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector; use Rector\Php81\Rector\ClassMethod\NewInInitializerRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; -use Rector\Php81\Rector\FunctionLike\IntersectionTypesRector; use Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector; use Rector\Php81\Rector\MethodCall\SpatieEnumMethodCallToEnumConstRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector; return static function (RectorConfig $rectorConfig) : void { - $rectorConfig->rules([ReturnNeverTypeRector::class, MyCLabsClassToEnumRector::class, MyCLabsMethodCallToEnumConstRector::class, FinalizePublicClassConstantRector::class, ReadOnlyPropertyRector::class, SpatieEnumClassToEnumRector::class, SpatieEnumMethodCallToEnumConstRector::class, NewInInitializerRector::class, IntersectionTypesRector::class, NullToStrictStringFuncCallArgRector::class, FirstClassCallableRector::class]); + $rectorConfig->rules([ReturnNeverTypeRector::class, MyCLabsClassToEnumRector::class, MyCLabsMethodCallToEnumConstRector::class, FinalizePublicClassConstantRector::class, ReadOnlyPropertyRector::class, SpatieEnumClassToEnumRector::class, SpatieEnumMethodCallToEnumConstRector::class, NewInInitializerRector::class, NullToStrictStringFuncCallArgRector::class, FirstClassCallableRector::class]); }; diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index 9d8c06e93d4..15e77d6f634 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 355 Rules Overview +# 354 Rules Overview
@@ -40,7 +40,7 @@ - [Php80](#php80) (16) -- [Php81](#php81) (10) +- [Php81](#php81) (9) - [Php82](#php82) (4) @@ -5070,27 +5070,6 @@ Upgrade array callable to first class callable
-### IntersectionTypesRector - -Change docs to intersection types, where possible (properties are covered by TypedPropertyRector (@todo)) - -- class: [`Rector\Php81\Rector\FunctionLike\IntersectionTypesRector`](../rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php) - -```diff - final class SomeClass - { -- /** -- * @param Foo&Bar $types -- */ -- public function process($types) -+ public function process(Foo&Bar $types) - { - } - } -``` - -
- ### MyCLabsClassToEnumRector Refactor MyCLabs enum class to native Enum diff --git a/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php b/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php deleted file mode 100644 index 2ead2bb19b9..00000000000 --- a/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php +++ /dev/null @@ -1,119 +0,0 @@ -> - */ - public function getNodeTypes() : array - { - return [ArrowFunction::class, Closure::class, ClassMethod::class, Function_::class]; - } - /** - * @param ArrowFunction|Closure|ClassMethod|Function_ $node - */ - public function refactor(Node $node) : ?Node - { - $this->hasChanged = \false; - $phpDocInfo = $this->phpDocInfoFactory->createFromNode($node); - if (!$phpDocInfo instanceof PhpDocInfo) { - return null; - } - $this->refactorParamTypes($node, $phpDocInfo); - // $this->refactorReturnType($node, $phpDocInfo); - if ($this->hasChanged) { - return $node; - } - return null; - } - public function provideMinPhpVersion() : int - { - return PhpVersionFeature::INTERSECTION_TYPES; - } - /** - * @param \PhpParser\Node\Expr\ArrowFunction|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike - */ - private function refactorParamTypes($functionLike, PhpDocInfo $phpDocInfo) : void - { - foreach ($functionLike->params as $param) { - if ($param->type !== null) { - continue; - } - /** @var string $paramName */ - $paramName = $this->getName($param->var); - $paramType = $phpDocInfo->getParamType($paramName); - if (!$paramType instanceof IntersectionType) { - continue; - } - if (!$this->isIntersectionableType($paramType)) { - continue; - } - $phpParserIntersectionType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType, TypeKind::PARAM); - if (!$phpParserIntersectionType instanceof Node\IntersectionType) { - continue; - } - $param->type = $phpParserIntersectionType; - $this->hasChanged = \true; - } - } - /** - * Only class-type are supported https://wiki.php.net/rfc/pure-intersection-types#supported_types - */ - private function isIntersectionableType(IntersectionType $intersectionType) : bool - { - foreach ($intersectionType->getTypes() as $intersectionedType) { - if ($intersectionedType instanceof TypeWithClassName) { - continue; - } - return \false; - } - return \true; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index dc0feee8b19..f24f634e765 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 = 'b0105f24cf32cfe12438e85c5033aa79bce9a1a4'; + public const PACKAGE_VERSION = '6b7aac835934de48c034aa8b2bad886616566e06'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-08-14 07:36:31'; + public const RELEASE_DATE = '2023-08-14 07:36:48'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index d031995d669..7c04467a7e6 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 ComposerAutoloaderInit4e479c6ca392702f962040c7fa54d1aa::getLoader(); +return ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 8e22defd958..5658b1d6d55 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2217,7 +2217,6 @@ return array( 'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php', 'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php', 'Rector\\Php81\\Rector\\FuncCall\\NullToStrictStringFuncCallArgRector' => $baseDir . '/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php', - 'Rector\\Php81\\Rector\\FunctionLike\\IntersectionTypesRector' => $baseDir . '/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php', 'Rector\\Php81\\Rector\\MethodCall\\MyCLabsMethodCallToEnumConstRector' => $baseDir . '/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php', 'Rector\\Php81\\Rector\\MethodCall\\SpatieEnumMethodCallToEnumConstRector' => $baseDir . '/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php', 'Rector\\Php81\\Rector\\Property\\ReadOnlyPropertyRector' => $baseDir . '/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 45fa8f099bb..fbed4f312bb 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit4e479c6ca392702f962040c7fa54d1aa +class ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e { private static $loader; @@ -22,17 +22,17 @@ class ComposerAutoloaderInit4e479c6ca392702f962040c7fa54d1aa return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit4e479c6ca392702f962040c7fa54d1aa', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit4e479c6ca392702f962040c7fa54d1aa', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitd0491821a1f961d1d51360ac6370685e::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$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 730d0ba5dbc..618af0e6655 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa +class ComposerStaticInitd0491821a1f961d1d51360ac6370685e { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -2470,7 +2470,6 @@ class ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa 'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php', 'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php', 'Rector\\Php81\\Rector\\FuncCall\\NullToStrictStringFuncCallArgRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php', - 'Rector\\Php81\\Rector\\FunctionLike\\IntersectionTypesRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/FunctionLike/IntersectionTypesRector.php', 'Rector\\Php81\\Rector\\MethodCall\\MyCLabsMethodCallToEnumConstRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector.php', 'Rector\\Php81\\Rector\\MethodCall\\SpatieEnumMethodCallToEnumConstRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/MethodCall/SpatieEnumMethodCallToEnumConstRector.php', 'Rector\\Php81\\Rector\\Property\\ReadOnlyPropertyRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php', @@ -2959,9 +2958,9 @@ class ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit4e479c6ca392702f962040c7fa54d1aa::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$classMap; }, null, ClassLoader::class); }