From f6370ebd5a48a43c7bc5e6021ecc859746a6c1d2 Mon Sep 17 00:00:00 2001 From: Luke Holder Date: Thu, 25 Sep 2025 14:55:30 +0100 Subject: [PATCH] WIP --- composer.json | 11 ++++---- phpunit.xml | 9 +++++++ sets/craft-cms-60.php | 17 ++++++++++++ signatures/craft-cms-60.php | 14 ++++++++++ src/SetList.php | 5 ++++ tests/set/craftcms60/CraftCMS60Test.php | 30 +++++++++++++++++++++ tests/set/craftcms60/fixture/plugin.php.inc | 11 ++++++++ 7 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 sets/craft-cms-60.php create mode 100644 signatures/craft-cms-60.php create mode 100644 tests/set/craftcms60/CraftCMS60Test.php create mode 100644 tests/set/craftcms60/fixture/plugin.php.inc diff --git a/composer.json b/composer.json index 9d51433..c26d35e 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,13 @@ "name": "craftcms/rector", "description": "Rector sets to automate Craft CMS upgrades", "require": { - "rector/rector": "^1.0.0" + "rector/rector": "^2.0.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "craftcms/cms": "^4.0.0|^5.0.0", + "phpunit/phpunit": "^12.0", + "craftcms/cms": "^4.0.0|^5.0.0|^6.x-dev", "craftcms/ecs": "dev-main", - "phpstan/phpstan": "^1.10", + "phpstan/phpstan": "^2.0.0", "symfony/var-exporter": "^6.0" }, "autoload": { @@ -24,7 +24,8 @@ "scripts": { "phpstan": "phpstan --ansi --memory-limit=1G", "check-cs": "ecs check --ansi", - "fix-cs": "ecs check --fix --ansi" + "fix-cs": "ecs check --fix --ansi", + "tests": "phpunit" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/phpunit.xml b/phpunit.xml index 3918a27..a4ece7c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -13,5 +13,14 @@ tests + + tests/set/craftcms40 + + + tests/set/craftcms50 + + + tests/set/craftcms60 + diff --git a/sets/craft-cms-60.php b/sets/craft-cms-60.php new file mode 100644 index 0000000..8509035 --- /dev/null +++ b/sets/craft-cms-60.php @@ -0,0 +1,17 @@ +ruleWithConfiguration(RenameClassRector::class, [ + 'craft\enums\Edition' => 'CraftCms\Cms\Edition', + ]); + + // Property/method signatures + SignatureConfigurator::configure($rectorConfig, 'craft-cms-60'); +}; diff --git a/signatures/craft-cms-60.php b/signatures/craft-cms-60.php new file mode 100644 index 0000000..a3475c9 --- /dev/null +++ b/signatures/craft-cms-60.php @@ -0,0 +1,14 @@ + [], + + // Method return types (empty for now, will be filled as needed) + 'methodReturnTypes' => [], + + // Method param types (empty for now, will be filled as needed) + 'methodParamTypes' => [], +]; \ No newline at end of file diff --git a/src/SetList.php b/src/SetList.php index 4cf0ecd..4880cc9 100644 --- a/src/SetList.php +++ b/src/SetList.php @@ -18,6 +18,11 @@ final class SetList implements SetListInterface */ public const CRAFT_CMS_50 = __DIR__ . '/../sets/craft-cms-50.php'; + /** + * @var string + */ + public const CRAFT_CMS_60 = __DIR__ . '/../sets/craft-cms-60.php'; + /** * @var string */ diff --git a/tests/set/craftcms60/CraftCMS60Test.php b/tests/set/craftcms60/CraftCMS60Test.php new file mode 100644 index 0000000..d7ca95b --- /dev/null +++ b/tests/set/craftcms60/CraftCMS60Test.php @@ -0,0 +1,30 @@ +doTestFile($filePath); + } + + public function provideData(): Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/fixture'); + } + + public function provideConfigFilePath(): string + { + return SetList::CRAFT_CMS_60; + } +} diff --git a/tests/set/craftcms60/fixture/plugin.php.inc b/tests/set/craftcms60/fixture/plugin.php.inc new file mode 100644 index 0000000..bd4a74b --- /dev/null +++ b/tests/set/craftcms60/fixture/plugin.php.inc @@ -0,0 +1,11 @@ + +----- +