From 79bfc87e90098afda624f98fe16b18a05f84f435 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 1 Jan 2025 16:35:01 +0000 Subject: [PATCH] Updated Rector to commit 66d93167af53e4116e73f6dc011f02ac23efbd6f https://github.com/rectorphp/rector-src/commit/66d93167af53e4116e73f6dc011f02ac23efbd6f [DeadCode] Add ReplaceBlockToItsStmtsRector (#6641) --- .../Block/ReplaceBlockToItsStmtsRector.php | 49 +++++++++++++++++++ src/Application/VersionResolver.php | 4 +- src/Config/Level/DeadCodeLevel.php | 2 + vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php diff --git a/rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php b/rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php new file mode 100644 index 00000000000..b8f158ccb53 --- /dev/null +++ b/rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php @@ -0,0 +1,49 @@ +> + */ + public function getNodeTypes() : array + { + return [Block::class]; + } + /** + * @param Block $node + * @return Stmt[] + */ + public function refactor(Node $node) : array + { + return $node->stmts; + } +} diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 66328226215..6d41e06f440 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 = 'f3242bfadc709ca567975be62691944b5f8301ee'; + public const PACKAGE_VERSION = '66d93167af53e4116e73f6dc011f02ac23efbd6f'; /** * @api * @var string */ - public const RELEASE_DATE = '2025-01-01 14:09:44'; + public const RELEASE_DATE = '2025-01-01 23:32:36'; /** * @var int */ diff --git a/src/Config/Level/DeadCodeLevel.php b/src/Config/Level/DeadCodeLevel.php index 9260df3a727..c85129d9f4f 100644 --- a/src/Config/Level/DeadCodeLevel.php +++ b/src/Config/Level/DeadCodeLevel.php @@ -8,6 +8,7 @@ use Rector\Contract\Rector\RectorInterface; use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector; use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector; use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector; +use Rector\DeadCode\Rector\Block\ReplaceBlockToItsStmtsRector; use Rector\DeadCode\Rector\BooleanAnd\RemoveAndTrueRector; use Rector\DeadCode\Rector\Cast\RecastingRemovalRector; use Rector\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector; @@ -80,6 +81,7 @@ final class DeadCodeLevel RemoveUnusedNonEmptyArrayBeforeForeachRector::class, RemoveNullPropertyInitializationRector::class, RemoveUselessReturnExprInConstructRector::class, + ReplaceBlockToItsStmtsRector::class, RemoveTypedPropertyDeadInstanceOfRector::class, TernaryToBooleanOrFalseToBooleanAndRector::class, RemoveDoubleAssignRector::class, diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 2139317cc3d..ba28672e2b0 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1303,6 +1303,7 @@ return array( 'Rector\\DeadCode\\Rector\\Array_\\RemoveDuplicatedArrayKeyRector' => $baseDir . '/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php', 'Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector' => $baseDir . '/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php', 'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedVariableAssignRector' => $baseDir . '/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php', + 'Rector\\DeadCode\\Rector\\Block\\ReplaceBlockToItsStmtsRector' => $baseDir . '/rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php', 'Rector\\DeadCode\\Rector\\BooleanAnd\\RemoveAndTrueRector' => $baseDir . '/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php', 'Rector\\DeadCode\\Rector\\Cast\\RecastingRemovalRector' => $baseDir . '/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php', 'Rector\\DeadCode\\Rector\\ClassConst\\RemoveUnusedPrivateClassConstantRector' => $baseDir . '/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 0cba10dff49..07f5e9bd39d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -1522,6 +1522,7 @@ class ComposerStaticInit4fb50f2d4af661ecee2245f9ff725125 'Rector\\DeadCode\\Rector\\Array_\\RemoveDuplicatedArrayKeyRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php', 'Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php', 'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedVariableAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php', + 'Rector\\DeadCode\\Rector\\Block\\ReplaceBlockToItsStmtsRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Block/ReplaceBlockToItsStmtsRector.php', 'Rector\\DeadCode\\Rector\\BooleanAnd\\RemoveAndTrueRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php', 'Rector\\DeadCode\\Rector\\Cast\\RecastingRemovalRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Cast/RecastingRemovalRector.php', 'Rector\\DeadCode\\Rector\\ClassConst\\RemoveUnusedPrivateClassConstantRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/ClassConst/RemoveUnusedPrivateClassConstantRector.php',