From aef03f3b6920525ca9187550c61f0f151ca8499d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 5 Aug 2023 17:58:26 +0000 Subject: [PATCH] Updated Rector to commit f76d034bf8eb60e7a7a2d73b2239aebf81b1ac51 https://github.com/rectorphp/rector-src/commit/f76d034bf8eb60e7a7a2d73b2239aebf81b1ac51 [DX] Remove NullifyUnionNullableRector, let cs tools handle it (#4660) --- docs/rector_rules_overview.md | 21 +--- .../Property/NullifyUnionNullableRector.php | 114 ------------------ 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 +- 7 files changed, 14 insertions(+), 147 deletions(-) delete mode 100644 rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index f859e4988123..8a0bd8da142c 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 364 Rules Overview +# 363 Rules Overview
@@ -8,7 +8,7 @@ - [CodeQuality](#codequality) (71) -- [CodingStyle](#codingstyle) (31) +- [CodingStyle](#codingstyle) (30) - [DeadCode](#deadcode) (42) @@ -2003,23 +2003,6 @@ Changes negate of empty comparison of nullable value to explicit === or !== comp
-### NullifyUnionNullableRector - -Changes already typed Type|null to ?Type - -- class: [`Rector\CodingStyle\Rector\Property\NullifyUnionNullableRector`](../rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php) - -```diff - final class SomeClass - { - -- private null|stdClass $property; -+ private ?stdClass $property; - } -``` - -
- ### PostIncDecToPreIncDecRector Use ++$value or --$value instead of `$value++` or `$value--` diff --git a/rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php b/rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php deleted file mode 100644 index b19b8f64b8b4..000000000000 --- a/rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php +++ /dev/null @@ -1,114 +0,0 @@ -unionTypeMapper = $unionTypeMapper; - } - public function getRuleDefinition() : RuleDefinition - { - return new RuleDefinition('Changes already typed Type|null to ?Type', [new CodeSample(<<<'CODE_SAMPLE' -final class SomeClass -{ - - private null|stdClass $property; -} -CODE_SAMPLE -, <<<'CODE_SAMPLE' -final class SomeClass -{ - - private ?stdClass $property; -} -CODE_SAMPLE -)]); - } - /** - * @return array> - */ - public function getNodeTypes() : array - { - return [Property::class, Param::class, ClassMethod::class, Closure::class, Function_::class, ArrowFunction::class]; - } - /** - * @param Property|Param|ClassMethod|Closure|Function_|ArrowFunction $node - */ - public function refactor(Node $node) : ?Node - { - if ($node instanceof Property || $node instanceof Param) { - return $this->processNullablePropertyParamType($node); - } - return $this->processNullableFunctionLikeReturnType($node); - } - public function provideMinPhpVersion() : int - { - return PhpVersionFeature::UNION_TYPES; - } - private function resolveNullableType(?Node $node) : ?NullableType - { - if (!$node instanceof Node) { - return null; - } - if (!$node instanceof UnionType) { - return null; - } - $nullableType = $this->unionTypeMapper->resolveTypeWithNullablePHPParserUnionType($node); - if (!$nullableType instanceof NullableType) { - return null; - } - return $nullableType; - } - /** - * @param \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $node - * @return null|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Param - */ - private function processNullablePropertyParamType($node) - { - $nullableType = $this->resolveNullableType($node->type); - if (!$nullableType instanceof NullableType) { - return null; - } - $node->type = $nullableType; - return $node; - } - /** - * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\ArrowFunction $functionLike - */ - private function processNullableFunctionLikeReturnType($functionLike) : ?FunctionLike - { - $nullableType = $this->resolveNullableType($functionLike->returnType); - if (!$nullableType instanceof NullableType) { - return null; - } - $functionLike->returnType = $nullableType; - return $functionLike; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 75bb4e63e264..0e811b7ec7bb 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 = '8c04f656b32d8d95a5139e59cbfbc508647dd3b1'; + public const PACKAGE_VERSION = 'f76d034bf8eb60e7a7a2d73b2239aebf81b1ac51'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-08-05 23:26:30'; + public const RELEASE_DATE = '2023-08-05 18:53:37'; /** * @var int */ diff --git a/vendor/autoload.php b/vendor/autoload.php index 97e54bb2a888..f6b380fb743b 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -22,4 +22,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit66f85fd3fcfdd09fa2c22cad4a577f36::getLoader(); +return ComposerAutoloaderInita2c899aec318d516f15998c8405c3588::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 358ae79ea788..9ad4b37f0744 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1477,7 +1477,6 @@ 'Rector\\CodingStyle\\Rector\\If_\\NullableCompareToNullRector' => $baseDir . '/rules/CodingStyle/Rector/If_/NullableCompareToNullRector.php', 'Rector\\CodingStyle\\Rector\\Plus\\UseIncrementAssignRector' => $baseDir . '/rules/CodingStyle/Rector/Plus/UseIncrementAssignRector.php', 'Rector\\CodingStyle\\Rector\\PostInc\\PostIncDecToPreIncDecRector' => $baseDir . '/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php', - 'Rector\\CodingStyle\\Rector\\Property\\NullifyUnionNullableRector' => $baseDir . '/rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php', 'Rector\\CodingStyle\\Rector\\Property\\SplitGroupedPropertiesRector' => $baseDir . '/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php', 'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => $baseDir . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php', 'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => $baseDir . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 3601838c5b48..349c79a7660c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit66f85fd3fcfdd09fa2c22cad4a577f36 +class ComposerAutoloaderInita2c899aec318d516f15998c8405c3588 { private static $loader; @@ -22,17 +22,17 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit66f85fd3fcfdd09fa2c22cad4a577f36', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInita2c899aec318d516f15998c8405c3588', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit66f85fd3fcfdd09fa2c22cad4a577f36', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInita2c899aec318d516f15998c8405c3588', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInita2c899aec318d516f15998c8405c3588::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); - $filesToLoad = \Composer\Autoload\ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36::$files; + $filesToLoad = \Composer\Autoload\ComposerStaticInita2c899aec318d516f15998c8405c3588::$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 9ff84542be65..ab8f101ff4b4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36 +class ComposerStaticInita2c899aec318d516f15998c8405c3588 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', @@ -1731,7 +1731,6 @@ class ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36 'Rector\\CodingStyle\\Rector\\If_\\NullableCompareToNullRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/If_/NullableCompareToNullRector.php', 'Rector\\CodingStyle\\Rector\\Plus\\UseIncrementAssignRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Plus/UseIncrementAssignRector.php', 'Rector\\CodingStyle\\Rector\\PostInc\\PostIncDecToPreIncDecRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/PostInc/PostIncDecToPreIncDecRector.php', - 'Rector\\CodingStyle\\Rector\\Property\\NullifyUnionNullableRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Property/NullifyUnionNullableRector.php', 'Rector\\CodingStyle\\Rector\\Property\\SplitGroupedPropertiesRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php', 'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php', 'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php', @@ -3016,9 +3015,9 @@ class ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit66f85fd3fcfdd09fa2c22cad4a577f36::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInita2c899aec318d516f15998c8405c3588::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInita2c899aec318d516f15998c8405c3588::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInita2c899aec318d516f15998c8405c3588::$classMap; }, null, ClassLoader::class); }