From 48397d3f811b9ea77a5744ad62c5ef363607fce8 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 19 Jun 2024 15:40:53 +0000 Subject: [PATCH] Updated Rector to commit a787d4c8f6b15ba3590e91746326241efeec8656 https://github.com/rectorphp/rector-src/commit/a787d4c8f6b15ba3590e91746326241efeec8656 Remove deprecated and empty FinalizeClassesWithoutChildrenRector + FinalizePublicClassConstantRector (#5980) --- docs/rector_rules_overview.md | 41 +----------- .../FinalizePublicClassConstantRector.php | 62 ------------------- .../FinalizeClassesWithoutChildrenRector.php | 62 ------------------- src/Application/VersionResolver.php | 4 +- .../PhpDocInfo/PhpDocInfo.php | 9 --- vendor/composer/autoload_classmap.php | 2 - vendor/composer/autoload_static.php | 2 - 7 files changed, 5 insertions(+), 177 deletions(-) delete mode 100644 rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php delete mode 100644 rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index e460902499e..1cf2cae7238 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -1,4 +1,4 @@ -# 382 Rules Overview +# 380 Rules Overview
@@ -42,7 +42,7 @@ - [Php80](#php80) (16) -- [Php81](#php81) (9) +- [Php81](#php81) (8) - [Php82](#php82) (5) @@ -50,7 +50,7 @@ - [Php84](#php84) (1) -- [Privatization](#privatization) (5) +- [Privatization](#privatization) (4) - [Removing](#removing) (5) @@ -5211,22 +5211,6 @@ Add `Stringable` interface to classes with `__toString()` method ## Php81 -### FinalizePublicClassConstantRector - -Add final to constants that does not have children - -- class: [`Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector`](../rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php) - -```diff - class SomeClass - { -- public const NAME = 'value'; -+ final public const NAME = 'value'; - } -``` - -
- ### FirstClassCallableRector Upgrade array callable to first class callable @@ -5552,25 +5536,6 @@ Make implicit nullable param to explicit ## Privatization -### FinalizeClassesWithoutChildrenRector - -Finalize every class that has no children - -- class: [`Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector`](../rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php) - -```diff --class FirstClass extends SecondClass -+final class FirstClass extends SecondClass - { - } - - class SecondClass - { - } -``` - -
- ### FinalizeTestCaseClassRector PHPUnit test case will be finalized diff --git a/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php b/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php deleted file mode 100644 index 4a241703d27..00000000000 --- a/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php +++ /dev/null @@ -1,62 +0,0 @@ -> - */ - public function getNodeTypes() : array - { - return [Class_::class]; - } - /** - * @param Class_ $node - */ - public function refactor(Node $node) : ?Node - { - if ($this->hasWarned) { - return null; - } - \trigger_error(\sprintf('The "%s" rule was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its risky to change.', self::class)); - \sleep(3); - $this->hasWarned = \true; - return null; - } - public function provideMinPhpVersion() : int - { - return PhpVersionFeature::FINAL_CLASS_CONSTANTS; - } -} diff --git a/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php b/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php deleted file mode 100644 index 5f4307e987b..00000000000 --- a/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php +++ /dev/null @@ -1,62 +0,0 @@ -> - */ - public function getNodeTypes() : array - { - return [Class_::class]; - } - /** - * @param Class_ $node - */ - public function refactor(Node $node) : ?Node - { - if ($this->hasWarned) { - return null; - } - \trigger_error(\sprintf('The "%s" rule was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its risky to change. Use "%s" instead', self::class, 'https://github.com/rectorphp/swiss-knife#4-finalize-classes-without-children')); - \sleep(3); - $this->hasWarned = \true; - return null; - } -} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index e5e95014327..75f3135b514 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 = '69872ef5930d31c13bb7c9b1650ff4137269c1a4'; + public const PACKAGE_VERSION = 'a787d4c8f6b15ba3590e91746326241efeec8656'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-06-19 15:52:02'; + public const RELEASE_DATE = '2024-06-19 17:37:29'; /** * @var int */ diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 4e201eacad0..eefea526929 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -361,15 +361,6 @@ final class PhpDocInfo { return $this->phpDocNode->getTemplateTagValues(); } - /** - * @deprecated Change doc block and print directly in the node instead - * Should be handled by attributes of phpdoc node - if stard_and_end is missing in one of nodes, it has been changed - * - * @api - */ - public function markAsChanged() : void - { - } public function makeMultiLined() : void { $this->isSingleLine = \false; diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 3547ab45acd..eedb0cffd75 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1929,7 +1929,6 @@ return array( 'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => $baseDir . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php', 'Rector\\Php81\\NodeFactory\\EnumFactory' => $baseDir . '/rules/Php81/NodeFactory/EnumFactory.php', 'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => $baseDir . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php', - 'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => $baseDir . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php', 'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => $baseDir . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php', 'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php', 'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php', @@ -2013,7 +2012,6 @@ return array( 'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => $baseDir . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php', 'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => $baseDir . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php', 'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => $baseDir . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php', - 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php', 'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php', 'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => $baseDir . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php', 'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => $baseDir . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index bb48f92ea50..aa0cc2c6192 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -2148,7 +2148,6 @@ class ComposerStaticInitc6bcdb63495c7f1cc77baa21ee134e8a 'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => __DIR__ . '/../..' . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php', 'Rector\\Php81\\NodeFactory\\EnumFactory' => __DIR__ . '/../..' . '/rules/Php81/NodeFactory/EnumFactory.php', 'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php', - 'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php', 'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php', 'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php', 'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php', @@ -2232,7 +2231,6 @@ class ComposerStaticInitc6bcdb63495c7f1cc77baa21ee134e8a 'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => __DIR__ . '/../..' . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php', 'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => __DIR__ . '/../..' . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php', 'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php', - 'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php', 'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php', 'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php', 'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',