From 7a8bc36a24e5bf659e011f09010b4d3654dabc66 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 21 Nov 2023 14:32:38 +0000 Subject: [PATCH] Updated Rector to commit 189a02635533f450aea58d8de075e494f538182b https://github.com/rectorphp/rector-src/commit/189a02635533f450aea58d8de075e494f538182b Remove deprecated Rector rules (#5270) --- docs/rector_rules_overview.md | 53 +------------- .../Switch_/BinarySwitchToIfElseRector.php | 52 -------------- ...omStrictConstructorReadonlyClassRector.php | 71 ------------------- src/Application/VersionResolver.php | 4 +- vendor/composer/autoload_classmap.php | 2 - vendor/composer/autoload_static.php | 2 - 6 files changed, 5 insertions(+), 179 deletions(-) delete mode 100644 rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php delete mode 100644 rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index e8c5154fc95..e940876e7f7 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 355 Rules Overview +# 353 Rules Overview
@@ -8,7 +8,7 @@ - [CodeQuality](#codequality) (72) -- [CodingStyle](#codingstyle) (29) +- [CodingStyle](#codingstyle) (28) - [DeadCode](#deadcode) (42) @@ -56,7 +56,7 @@ - [Transform](#transform) (22) -- [TypeDeclaration](#typedeclaration) (42) +- [TypeDeclaration](#typedeclaration) (41) - [Visibility](#visibility) (3) @@ -1623,29 +1623,6 @@ Change `array_merge()` to spread operator
-### BinarySwitchToIfElseRector - -Changes switch with 2 options to if-else - -- class: [`Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector`](../rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php) - -```diff --switch ($foo) { -- case 'my string': -- $result = 'ok'; -- break; -- -- default: -- $result = 'not ok'; -+if ($foo == 'my string') { -+ $result = 'ok'; -+} else { -+ $result = 'not ok'; - } -``` - -
- ### CallUserFuncArrayToVariadicRector Replace `call_user_func_array()` with variadic @@ -7022,30 +6999,6 @@ Add typed property from assigned types
-### TypedPropertyFromStrictConstructorReadonlyClassRector - -Add typed public properties based only on strict constructor types in readonly classes - -- class: [`Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorReadonlyClassRector`](../rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php) - -```diff - /** - * @immutable - */ - class SomeObject - { -- public $name; -+ public string $name; - - public function __construct(string $name) - { - $this->name = $name; - } - } -``` - -
- ### TypedPropertyFromStrictConstructorRector Add typed properties based only on strict constructor types diff --git a/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php b/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php deleted file mode 100644 index 8b1b1e49aff..00000000000 --- a/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php +++ /dev/null @@ -1,52 +0,0 @@ -> - */ - public function getNodeTypes() : array - { - return [Switch_::class]; - } - /** - * @param Switch_ $node - */ - public function refactor(Node $node) : ?Node - { - \trigger_error(\sprintf('The "%s" rule is deprecated as prevents refactoring to match (), use PHPStan, manual handling and PHP 8.0 upgrade set instead.', self::class), \E_USER_ERROR); - return null; - } -} diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php deleted file mode 100644 index 0a8325d5594..00000000000 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php +++ /dev/null @@ -1,71 +0,0 @@ -name = $name; - } -} -CODE_SAMPLE -, <<<'CODE_SAMPLE' -/** - * @immutable - */ -class SomeObject -{ - public string $name; - - public function __construct(string $name) - { - $this->name = $name; - } -} -CODE_SAMPLE -)]); - } - /** - * @return array> - */ - public function getNodeTypes() : array - { - return [Class_::class]; - } - /** - * @param Class_ $node - */ - public function refactorWithScope(Node $node, Scope $scope) : ?Node - { - \trigger_error(\sprintf('The "%s" rule is deprecated as based on docblock and public elements. Use private properties and property promotion rules instead.', self::class), \E_USER_ERROR); - return null; - } - public function provideMinPhpVersion() : int - { - return PhpVersionFeature::TYPED_PROPERTIES; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 48cb924815f..3a14a6bb09e 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 = 'a9797fdc1ca6b8d7080fb1299b44fcb94ecd5936'; + public const PACKAGE_VERSION = '189a02635533f450aea58d8de075e494f538182b'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-11-21 15:26:30'; + public const RELEASE_DATE = '2023-11-21 14:30:22'; /** * @var int */ diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 8204812a593..d129e5b7bd3 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1138,7 +1138,6 @@ return array( 'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => $baseDir . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php', 'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => $baseDir . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php', 'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => $baseDir . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php', - 'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => $baseDir . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php', 'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => $baseDir . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php', 'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php', 'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => $baseDir . '/rules/CodingStyle/Reflection/VendorLocationDetector.php', @@ -2327,7 +2326,6 @@ return array( 'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => $baseDir . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php', - 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorReadonlyClassRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 1a716931b17..e905bfbf1f4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1356,7 +1356,6 @@ class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185 'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php', 'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php', 'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php', - 'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php', 'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php', 'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php', 'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => __DIR__ . '/../..' . '/rules/CodingStyle/Reflection/VendorLocationDetector.php', @@ -2545,7 +2544,6 @@ class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185 'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php', - 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorReadonlyClassRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php', 'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php',