This package contains a Rector ruleset which is used for migrating from Neos 8.x to 9.0 (and lateron also further up).
Right now we focus especially on rules to migrate from the old Content Repository API (< Neos 9.0) to the Event Sourced Content Repository (>= 9.0).
PHP-only migrations
Earlier version of neos/rector also did the migration of Yaml and Fusion file. They have been moved into Neos core migrations starting version 9.0.8. Now neos/rector only contains PHP migrations.
See for more details: neos/neos-development-collection#5607
Please install the neos/rector package in your Distribution as a dev dependency with composer.
(This has changed to previous versions of this package)
# inside your Distribution folder
composer require --dev neos/rector:dev-main
cp Packages/Libraries/neos/rector/rector.template.php rector.phpNow, open up the rector.php file copied above, and adjust the Rector Paths (these are the paths which shall be
migrated). By default, all of ./DistributionPackages will be migrated.
Right now, we ship the following sets of Rector rules:
\Neos\Rector\NeosRectorSets::CONTENTREPOSITORY_9_0: all rules needed to migrate to the Event-Sourced Content Repository
$rectorConfig->sets([
NeosRectorSets::CONTENTREPOSITORY_9_0,
]);
$rectorConfig->paths([
// TODO: Start adding your paths here, like so:
__DIR__ . '/DistributionPackages/'
]);Run the following command at the root of your distribution (i.e. where rector.php is located).
# for trying out what would be done
./bin/rector --dry-run
# for running the migrations
./bin/rector(This section is not relevant for users, but for developers of the Neos Rector packages)
Make sure to run Rector with the --clear-cache flag while developing rules, when you run them on a full codebase.
Otherwise, Rector might not re-run for unmodified source files.
We develop all Rector Rules completely test-driven.
The test setup runs completely self contained; does not need any Distribution set up.
# if inside a Neos Distribution, change to the Package's folder
cd Packages/Libraries/neos/rector
# install PHPunit
composer install
# run PHPUnit
composer testscomposer run generate-docs