From 4ad449613e76717effcd529f4c25503b7b35be9e Mon Sep 17 00:00:00 2001 From: othercorey Date: Wed, 19 Nov 2025 14:14:58 -0600 Subject: [PATCH 1/8] Add no-diff option (#360) --- src/Command/RectorCommand.php | 7 ++++++- tests/TestCase/Command/RectorCommandTest.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Command/RectorCommand.php b/src/Command/RectorCommand.php index 9ec3a8d6..2098f1b9 100644 --- a/src/Command/RectorCommand.php +++ b/src/Command/RectorCommand.php @@ -83,10 +83,11 @@ protected function runRector(ConsoleIo $io, Arguments $args, string $autoload): $cmdPath = ROOT . '/vendor/bin/rector process'; $command = sprintf( - '%s %s %s --autoload-file=%s --config=%s %s --clear-cache', + '%s %s %s %s --autoload-file=%s --config=%s %s --clear-cache', $cmdPath, $args->getOption('dry-run') ? '--dry-run' : '', $args->getOption('verbose') ? '--debug' : '', + $args->getOption('no-diff') ? '--no-diff' : '', escapeshellarg($autoload), escapeshellarg($config), escapeshellarg($path), @@ -199,6 +200,10 @@ protected function buildOptionParser(ConsoleOptionParser $parser): ConsoleOption ->addOption('dry-run', [ 'help' => 'Enable to get a preview of what modifications will be applied.', 'boolean' => true, + ]) + ->addOption('no-diff', [ + 'help' => 'Disable rector diff output which can cause issues with large files.', + 'boolean' => true, ]); return $parser; diff --git a/tests/TestCase/Command/RectorCommandTest.php b/tests/TestCase/Command/RectorCommandTest.php index 6925df2c..97bbb9d4 100644 --- a/tests/TestCase/Command/RectorCommandTest.php +++ b/tests/TestCase/Command/RectorCommandTest.php @@ -68,6 +68,16 @@ public function testApplyAppDir() $this->assertOutputContains('Rector applied successfully'); } + public function testApplyNoDiff() + { + $this->setupTestApp(__FUNCTION__); + $this->exec('upgrade rector --rules cakephp40 --dry-run --no-diff ' . TEST_APP); + + $this->assertExitSuccess(); + $this->assertOutputNotContains('begin diff'); + $this->assertOutputContains('Rector applied successfully'); + } + /** * @return void */ From d88167d20fcb40dc908415f4df059c2d15266f67 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 20 Nov 2025 20:16:25 +0700 Subject: [PATCH 2/8] Handle soon deprecated AttributeKey::STMT_KEY attribute usage on Stmt (#362) * Handle soon deprecated AttributeKey::STMT_KEY attribute usage on Stmt * fix cs --- .../AppUsesStaticCallToUseStatementRector.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Rector/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php b/src/Rector/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php index f571d0d6..275235a4 100644 --- a/src/Rector/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php +++ b/src/Rector/Rector/Namespace_/AppUsesStaticCallToUseStatementRector.php @@ -15,7 +15,6 @@ use PhpParser\NodeVisitor; use PHPStan\Type\ObjectType; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; -use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\Node\BetterNodeFinder; use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace; use Rector\PhpParser\Node\Value\ValueResolver; @@ -128,8 +127,13 @@ function (Node $subNode) use ($node, $appUsesStaticCalls, &$currentStmt) { return null; } - /** @var \PhpParser\Node\Stmt $currentStmt */ - unset($node->stmts[$currentStmt->getAttribute(AttributeKey::STMT_KEY)]); + foreach ($node->stmts as $key => $stmt) { + if ($stmt === $currentStmt) { + unset($node->stmts[$key]); + + return null; + } + } return null; }, From af71e65036dea40336d8eba29bddc78504f33f6d Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Fri, 21 Nov 2025 05:56:33 +0100 Subject: [PATCH 3/8] Add Migrations 5.0 rector rules for PHINX_TYPE_* constant renaming (#361) This adds rector rules to automatically upgrade migrations from the deprecated PHINX_TYPE_* constants to the new TYPE_* constants introduced in Migrations 5.0. Changes: - Add config/rector/migrations50.php entry point - Add config/rector/sets/migrations50.php with constant rename rules - Update CakePHPSetList with MIGRATIONS_50 constant - Update README.md with migrations50 documentation The rules rename all deprecated PHINX_TYPE_* constants to their new TYPE_* equivalents, matching the naming conventions of Cake\Database\Schema\TableSchemaInterface: - PHINX_TYPE_STRING -> TYPE_STRING - PHINX_TYPE_TINY_INTEGER -> TYPE_TINYINTEGER - PHINX_TYPE_BINARYUUID -> TYPE_BINARY_UUID - etc. See: https://github.com/cakephp/migrations/issues/948 Co-authored-by: Rector Bot --- README.md | 4 +++ config/rector/migrations50.php | 9 ++++++ config/rector/sets/migrations50.php | 50 +++++++++++++++++++++++++++++ src/Rector/Set/CakePHPSetList.php | 5 +++ 4 files changed, 68 insertions(+) create mode 100644 config/rector/migrations50.php create mode 100644 config/rector/sets/migrations50.php diff --git a/README.md b/README.md index 7755e9de..21be2ab2 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ The upgrade tool also includes rulesets for related tools and libraries: - **chronos3** - Upgrade to Chronos 3.x - **migrations45** - Upgrade to Migrations 4.5 +- **migrations50** - Upgrade to Migrations 5.0 - **phpunit80** - Upgrade to PHPUnit 8.0 ```bash @@ -114,6 +115,9 @@ bin/cake upgrade rector --rules chronos3 /path/to/your/app/src # Apply Migrations 4.5 upgrade rules bin/cake upgrade rector --rules migrations45 /path/to/your/app/config +# Apply Migrations 5.0 upgrade rules +bin/cake upgrade rector --rules migrations50 /path/to/your/app/config + # Apply PHPUnit 8.0 upgrade rules bin/cake upgrade rector --rules phpunit80 /path/to/your/app/tests ``` diff --git a/config/rector/migrations50.php b/config/rector/migrations50.php new file mode 100644 index 00000000..a4e8397e --- /dev/null +++ b/config/rector/migrations50.php @@ -0,0 +1,9 @@ +sets([CakePHPSetList::MIGRATIONS_50]); +}; diff --git a/config/rector/sets/migrations50.php b/config/rector/sets/migrations50.php new file mode 100644 index 00000000..e61349da --- /dev/null +++ b/config/rector/sets/migrations50.php @@ -0,0 +1,50 @@ +ruleWithConfiguration(RenameClassConstFetchRector::class, [ + // Standard types + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_STRING', 'TYPE_STRING'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_CHAR', 'TYPE_CHAR'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TEXT', 'TYPE_TEXT'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INTEGER', 'TYPE_INTEGER'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TINY_INTEGER', 'TYPE_TINYINTEGER'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_SMALL_INTEGER', 'TYPE_SMALLINTEGER'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BIG_INTEGER', 'TYPE_BIGINTEGER'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_FLOAT', 'TYPE_FLOAT'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DECIMAL', 'TYPE_DECIMAL'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DATETIME', 'TYPE_DATETIME'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TIMESTAMP', 'TYPE_TIMESTAMP'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TIME', 'TYPE_TIME'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DATE', 'TYPE_DATE'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BINARY', 'TYPE_BINARY'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BINARYUUID', 'TYPE_BINARY_UUID'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BOOLEAN', 'TYPE_BOOLEAN'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_JSON', 'TYPE_JSON'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_UUID', 'TYPE_UUID'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_NATIVEUUID', 'TYPE_NATIVE_UUID'), + + // Geospatial types + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_GEOMETRY', 'TYPE_GEOMETRY'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_POINT', 'TYPE_POINT'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_LINESTRING', 'TYPE_LINESTRING'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_POLYGON', 'TYPE_POLYGON'), + + // Geospatial array constant + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPES_GEOSPATIAL', 'TYPES_GEOSPATIAL'), + + // Database-specific types + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_YEAR', 'TYPE_YEAR'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_CIDR', 'TYPE_CIDR'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INET', 'TYPE_INET'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_MACADDR', 'TYPE_MACADDR'), + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INTERVAL', 'TYPE_INTERVAL'), + ]); +}; diff --git a/src/Rector/Set/CakePHPSetList.php b/src/Rector/Set/CakePHPSetList.php index 65b1d975..6a0b0fc9 100644 --- a/src/Rector/Set/CakePHPSetList.php +++ b/src/Rector/Set/CakePHPSetList.php @@ -95,6 +95,11 @@ final class CakePHPSetList */ public const MIGRATIONS_45 = __DIR__ . '/../../../config/rector/sets/migrations45.php'; + /** + * @var string + */ + public const MIGRATIONS_50 = __DIR__ . '/../../../config/rector/sets/migrations50.php'; + /** * @var string */ From 6ac02d57cbaa6dba1a8621f42c576765b7e80408 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Fri, 21 Nov 2025 16:32:15 -0600 Subject: [PATCH 4/8] Fix connection helper rector processing unrelated nodes --- src/Rector/Rector/MethodCall/StaticConnectionHelperRector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Rector/Rector/MethodCall/StaticConnectionHelperRector.php b/src/Rector/Rector/MethodCall/StaticConnectionHelperRector.php index 392104c4..5f3319fc 100644 --- a/src/Rector/Rector/MethodCall/StaticConnectionHelperRector.php +++ b/src/Rector/Rector/MethodCall/StaticConnectionHelperRector.php @@ -51,10 +51,10 @@ public function refactor(Node $node): ?Node $parent = $node->getAttribute(AttributeKey::PARENT_NODE); if ($parent instanceof Expression) { $this->removeNode($parent); - - return null; } } + + return null; } // Ensure the node is a method call on the ConnectionHelper instance From 63199da0cca7f9916c80daeb118fc3d6987f09aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 18:42:56 +0100 Subject: [PATCH 5/8] Bump actions/checkout from 5 to 6 (#364) Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32eab1ce..5242bf33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: prefer-lowest: 'prefer-lowest' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -78,7 +78,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 From 45bc1597e48d70a65d15d7b146e41bb317f6332e Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Wed, 26 Nov 2025 21:53:38 +0100 Subject: [PATCH 6/8] Disable code coverage to fix php-parser conflict with rector (#366) --- .github/workflows/ci.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5242bf33..61d87306 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: with: php-version: ${{ matrix.php-version }} extensions: mbstring, intl - coverage: pcov + coverage: none - name: Get composer cache directory id: composer-cache @@ -62,16 +62,7 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run PHPUnit - run: | - if [[ ${{ matrix.php-version }} == '8.1' ]]; then - export CODECOVERAGE=1 && vendor/bin/phpunit --display-incomplete --display-skipped --coverage-clover=coverage.xml - else - vendor/bin/phpunit - fi - - - name: Submit code coverage - if: matrix.php-version == '8.1' - uses: codecov/codecov-action@v5 + run: vendor/bin/phpunit --display-incomplete --display-skipped cs-stan: name: Coding Standard & Static Analysis From 05622b3c540febff90a92c5fa2b86979657bf139 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Thu, 27 Nov 2025 11:05:29 +0100 Subject: [PATCH 7/8] merge 5.x => 6.x --- config/rector/migrations50.php | 2 +- src/Command/RectorCommand.php | 4 ++-- src/Rector/CakePHPSetList.php | 5 +++++ tests/TestCase/Command/RectorCommandTest.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/rector/migrations50.php b/config/rector/migrations50.php index a4e8397e..70ca4023 100644 --- a/config/rector/migrations50.php +++ b/config/rector/migrations50.php @@ -1,7 +1,7 @@ getOption('dry-run') ? '--dry-run' : '', $args->getOption('verbose') ? '--debug' : '', - $args->getOption('no-diff') ? '--no-diff' : '', + $args->getOption('no-diff') ? '--no-diffs' : '', escapeshellarg($autoload), escapeshellarg($config), escapeshellarg($path), diff --git a/src/Rector/CakePHPSetList.php b/src/Rector/CakePHPSetList.php index 3b1f8695..bbc9bd3b 100644 --- a/src/Rector/CakePHPSetList.php +++ b/src/Rector/CakePHPSetList.php @@ -100,6 +100,11 @@ final class CakePHPSetList */ public const MIGRATIONS_45 = __DIR__ . '/../../config/rector/sets/migrations45.php'; + /** + * @var string + */ + public const MIGRATIONS_50 = __DIR__ . '/../../config/rector/sets/migrations50.php'; + /** * @var string */ diff --git a/tests/TestCase/Command/RectorCommandTest.php b/tests/TestCase/Command/RectorCommandTest.php index a85f876b..91f92979 100644 --- a/tests/TestCase/Command/RectorCommandTest.php +++ b/tests/TestCase/Command/RectorCommandTest.php @@ -74,7 +74,7 @@ public function testApplyNoDiff() $this->assertExitSuccess(); $this->assertOutputNotContains('begin diff'); - $this->assertOutputContains('Rector applied successfully'); + $this->assertOutputContains('Rector completed successfully'); } /** From 434375472eddd27f05fe0557e612ecc3b39ee9a3 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Thu, 27 Nov 2025 11:29:00 +0100 Subject: [PATCH 8/8] cleanup migrations 5.0 config --- config/rector/sets/migrations50.php | 69 ++++++++++++++++------------- src/Rector/Set/CakePHPSetList.php | 0 2 files changed, 38 insertions(+), 31 deletions(-) delete mode 100644 src/Rector/Set/CakePHPSetList.php diff --git a/config/rector/sets/migrations50.php b/config/rector/sets/migrations50.php index e61349da..4e29739e 100644 --- a/config/rector/sets/migrations50.php +++ b/config/rector/sets/migrations50.php @@ -9,42 +9,49 @@ * @see https://github.com/cakephp/migrations/releases/5.0.0/ */ return static function (RectorConfig $rectorConfig): void { - $rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [ + + $constantMap = [ // Standard types - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_STRING', 'TYPE_STRING'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_CHAR', 'TYPE_CHAR'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TEXT', 'TYPE_TEXT'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INTEGER', 'TYPE_INTEGER'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TINY_INTEGER', 'TYPE_TINYINTEGER'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_SMALL_INTEGER', 'TYPE_SMALLINTEGER'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BIG_INTEGER', 'TYPE_BIGINTEGER'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_FLOAT', 'TYPE_FLOAT'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DECIMAL', 'TYPE_DECIMAL'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DATETIME', 'TYPE_DATETIME'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TIMESTAMP', 'TYPE_TIMESTAMP'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_TIME', 'TYPE_TIME'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_DATE', 'TYPE_DATE'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BINARY', 'TYPE_BINARY'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BINARYUUID', 'TYPE_BINARY_UUID'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_BOOLEAN', 'TYPE_BOOLEAN'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_JSON', 'TYPE_JSON'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_UUID', 'TYPE_UUID'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_NATIVEUUID', 'TYPE_NATIVE_UUID'), + 'PHINX_TYPE_STRING' => 'TYPE_STRING', + 'PHINX_TYPE_CHAR' => 'TYPE_CHAR', + 'PHINX_TYPE_TEXT' => 'TYPE_TEXT', + 'PHINX_TYPE_INTEGER' => 'TYPE_INTEGER', + 'PHINX_TYPE_TINY_INTEGER' => 'TYPE_TINYINTEGER', + 'PHINX_TYPE_SMALL_INTEGER' => 'TYPE_SMALLINTEGER', + 'PHINX_TYPE_BIG_INTEGER' => 'TYPE_BIGINTEGER', + 'PHINX_TYPE_FLOAT' => 'TYPE_FLOAT', + 'PHINX_TYPE_DECIMAL' => 'TYPE_DECIMAL', + 'PHINX_TYPE_DATETIME' => 'TYPE_DATETIME', + 'PHINX_TYPE_TIMESTAMP' => 'TYPE_TIMESTAMP', + 'PHINX_TYPE_TIME' => 'TYPE_TIME', + 'PHINX_TYPE_DATE' => 'TYPE_DATE', + 'PHINX_TYPE_BINARY' => 'TYPE_BINARY', + 'PHINX_TYPE_BINARYUUID' => 'TYPE_BINARY_UUID', + 'PHINX_TYPE_BOOLEAN' => 'TYPE_BOOLEAN', + 'PHINX_TYPE_JSON' => 'TYPE_JSON', + 'PHINX_TYPE_UUID' => 'TYPE_UUID', + 'PHINX_TYPE_NATIVEUUID' => 'TYPE_NATIVE_UUID', // Geospatial types - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_GEOMETRY', 'TYPE_GEOMETRY'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_POINT', 'TYPE_POINT'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_LINESTRING', 'TYPE_LINESTRING'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_POLYGON', 'TYPE_POLYGON'), + 'PHINX_TYPE_GEOMETRY' => 'TYPE_GEOMETRY', + 'PHINX_TYPE_POINT' => 'TYPE_POINT', + 'PHINX_TYPE_LINESTRING' => 'TYPE_LINESTRING', + 'PHINX_TYPE_POLYGON' => 'TYPE_POLYGON', // Geospatial array constant - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPES_GEOSPATIAL', 'TYPES_GEOSPATIAL'), + 'PHINX_TYPES_GEOSPATIAL' => 'TYPES_GEOSPATIAL', // Database-specific types - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_YEAR', 'TYPE_YEAR'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_CIDR', 'TYPE_CIDR'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INET', 'TYPE_INET'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_MACADDR', 'TYPE_MACADDR'), - new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', 'PHINX_TYPE_INTERVAL', 'TYPE_INTERVAL'), - ]); + 'PHINX_TYPE_YEAR' => 'TYPE_YEAR', + 'PHINX_TYPE_CIDR' => 'TYPE_CIDR', + 'PHINX_TYPE_INET' => 'TYPE_INET', + 'PHINX_TYPE_MACADDR' => 'TYPE_MACADDR', + 'PHINX_TYPE_INTERVAL', 'TYPE_INTERVAL', + ]; + + foreach ($constantMap as $oldConstant => $newConstant) { + $rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [ + new RenameClassConstFetch('Migrations\Db\Adapter\AdapterInterface', $oldConstant, $newConstant), + ]); + } }; diff --git a/src/Rector/Set/CakePHPSetList.php b/src/Rector/Set/CakePHPSetList.php deleted file mode 100644 index e69de29b..00000000