Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
df1c183
WIP Upgrade package to rector/rector 1.0
dlubitz May 3, 2024
7f498f2
Merge branch 'main' into upgrade-1.x
dlubitz Jul 25, 2025
527e209
FEATURE: Upgrade to Rector 2.0
dlubitz Jul 25, 2025
56f6208
FEATURE: Upgrade to Rector 2.0
dlubitz Jul 25, 2025
fb76222
TASK: Upgrade PHPUnit and rule-doc-generator
dlubitz Oct 9, 2025
a607f3b
TASK: Implement interfaces for rule documentation generation
dlubitz Oct 9, 2025
b8c3407
BUGFIX: Handle also return statements
dlubitz Oct 10, 2025
d0dfad8
BUGFIX: Allow expressions instead of variables to get passed
dlubitz Oct 10, 2025
6e34018
FEATURE: Update NodeGetPathRector to Rector 2.0
dlubitz Oct 10, 2025
51e272d
FEATURE: Update MethodCallToWarningCommentRector to Rector 2.0
dlubitz Oct 10, 2025
de04402
FEATURE: Update NodeGetDimensionsRector to Rector 2.0
dlubitz Oct 12, 2025
e6bdfa0
FEATURE: Update NodeGetContextGetWorkspaceRector to Rector 2.0
dlubitz Oct 12, 2025
c45b8dd
FEATURE: Use Statement for get more code occurrences
dlubitz Oct 12, 2025
4775d58
FEATURE: Update NodeGetChildNodesRector to Rector 2.0
dlubitz Oct 12, 2025
f738522
FEATURE: Update WorkspacePublishNodeRector to Rector 2.0
dlubitz Oct 12, 2025
7aabad8
FEATURE: Update WorkspacePublishRector to Rector 2.0
dlubitz Oct 12, 2025
4742acd
FEATURE: Update WorkspaceGetNameRector to Rector 2.0
dlubitz Oct 12, 2025
7bf4869
FEATURE: Add missing interfaces
dlubitz Oct 12, 2025
dd8a7f1
FEATURE: Update WorkspaceGetDescriptionRector and WorkspaceGetTitleRe…
dlubitz Oct 12, 2025
1ce9107
FEATURE: Refactor class checks
dlubitz Oct 12, 2025
a33b7ab
FEATURE: Update WorkspaceGetBaseWorkspacesRector and WorkspaceGetBase…
dlubitz Oct 12, 2025
ed86951
FEATURE: Update NodeGetParentRector to Rector 2.0
dlubitz Oct 13, 2025
3d32f7a
FEATURE: Update NodeTypeManagerAccessRector to Rector 2.0
dlubitz Oct 13, 2025
b3f3144
FEATURE: Update ObjectInstantiationToWarningCommentRector to Rector 2.0
dlubitz Oct 13, 2025
c17f54e
TASK: Remove NodeLegacyStub
dlubitz Oct 20, 2025
2c0f6a2
FEATURE: Update WorkspaceRepository findByWorkspace and findByIdentif…
dlubitz Nov 9, 2025
e31fcc5
FEATURE: Update WorkspaceRepository countByName to Rector 2.0
dlubitz Nov 9, 2025
aef2d2f
FEATURE: Update NodeType getTypeOfAutoCreatedChildNode to Rector 2.0
dlubitz Nov 9, 2025
5ee7d47
FEATURE: Update NodeType getAutoCreatedChildNodes to Rector 2.0
dlubitz Nov 9, 2025
e358118
FEATURE: Update NodeType getTypeOfAutoCreatedChildNode to Rector 2.0
dlubitz Nov 9, 2025
aceb292
TASK: Remove RemoveDuplicateCommentRector as it didn't work as expected.
dlubitz Nov 9, 2025
5a6cf1d
FEATURE: Update NodeType allowsGrandchildNodeType to Rector 2.0
dlubitz Nov 9, 2025
09c5a12
TASK: Add missing DocumentedRuleInterface notations
dlubitz Nov 9, 2025
80fe27a
TASK: Remove RemoveDuplicateCommentRector as it didn't work as expected.
dlubitz Nov 9, 2025
ba8e695
FEATURE: Update NodeSearchService findDescendantNodes to Rector 2.0
dlubitz Nov 9, 2025
b51dc1f
FEATURE: Update NodeGetNodeTypeRector to Rector 2.0
dlubitz Nov 9, 2025
98e8a79
FEATURE: Update NodeGetIdentifierRector to Rector 2.0
dlubitz Nov 9, 2025
7fb54bf
FEATURE: Update NodeGetDepthRector to Rector 2.0
dlubitz Nov 9, 2025
6057878
FEATURE: Update NodeFindParentNodeRector to Rector 2.0
dlubitz Nov 9, 2025
7d707e6
FEATURE: Update NodeGetHiddenBeforeAfterDateTimeRector to Rector 2.0
dlubitz Nov 9, 2025
1c63511
TASK: Update test Sets to already fixed rules
dlubitz Nov 9, 2025
9195adf
TASK: Copy MethodCallToPropertyFetchRector from phprector/rector as i…
dlubitz Nov 9, 2025
2485f84
TASK: Enable PHP 8.4 pipeline
dlubitz Nov 9, 2025
67e67e8
TASK: Copy MethodCallToPropertyFetchRector from phprector/rector as i…
dlubitz Nov 19, 2025
e1de938
TASK: Remove tests for AnnotationToAttribute as they do not work with…
dlubitz Nov 19, 2025
1a1d4c8
TASK: Add missing DocumentedRuleInterface notations
dlubitz Nov 22, 2025
b21572c
FEATURE: Update SignalSlotToWarningCommentRector to Rector 2.0
dlubitz Nov 22, 2025
36c0a1c
BUGFIX: Fix namespaces in test cases
dlubitz Nov 22, 2025
9c3bf15
FEATURE: Update ContextGetRootNodeRector to Rector 2.0
dlubitz Nov 22, 2025
43b517a
FEATURE: Update NodeGetNodeTypeGetNameRector to Rector 2.0
dlubitz Nov 22, 2025
5dd4e39
TASK: Adopt test as chained calls with MethodToProperty rectors do no…
dlubitz Nov 22, 2025
3e769ca
TASK: Update docs
dlubitz Nov 22, 2025
8566e13
TASK: Remove 8.2 from pipeline as PHPUnit requires at least 8.3 for r…
dlubitz Nov 22, 2025
8d9fc71
TASK: Adopt documentation
dlubitz Nov 22, 2025
5b408ad
TASK: Adopt documentation and template
dlubitz Nov 22, 2025
2260f3b
FEATURE: Update ContentDimensionCombinatorGetAllAllowedCombinationsRe…
dlubitz Nov 24, 2025
f3cf43e
TASK: Formatting
dlubitz Nov 24, 2025
0c87d46
TASK: Add more information to readme
dlubitz Dec 12, 2025
ec5d5c6
BUGFIX: Add comments instead of replace them
dlubitz Dec 12, 2025
0845891
TASK: Remove autoload paths
dlubitz Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3']
php-versions: ['8.3', '8.4']

runs-on: ubuntu-latest

Expand Down
84 changes: 20 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@

This package contains a Rector ruleset which is used for migrating from Neos 8.x to 9.0 (and lateron also further up).

It will eventually replace Core/Code Migrations (./flow flow:core:migrate) (which are not used anymore for migrating to Neos 9 and further).

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: https://github.com/neos/neos-development-collection/issues/5607



## Installation
As Rector has strict dependency requirements, which might not match your own project, we strongly recommend to install
neos/rector in a dedicated directory and **not to add it to your project**.

Please install the neos/rector package in your Distribution as a dev dependency with composer.
<br>(This has changed to previous versions of this package)

```bash
# inside your Distribution folder
composer create-project neos/rector:dev-main --stability=dev rector
cp rector/rector.template.php rector.php
composer require --dev neos/rector:dev-main
cp Packages/Libraries/neos/rector/rector.template.php rector.php
```

## Configuration
Expand All @@ -24,19 +31,12 @@ 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

Also you need to add the autoload paths, to allow rector to parse your code properly. By default we added `./Packages` and `./DistributionPackages` to the template.
- `\Neos\Rector\NeosRectorSets::CONTENTREPOSITORY_9_0`: all rules needed to migrate to the Event-Sourced Content
Repository

```php
$rectorConfig->sets([
NeosRectorSets::CONTENTREPOSITORY_9_0,
//NeosRectorSets::NEOS_8_4,
]);

$rectorConfig->autoloadPaths([
__DIR__ . '/Packages',
__DIR__ . '/DistributionPackages',
]);

$rectorConfig->paths([
Expand All @@ -52,11 +52,12 @@ Run the following command at the root of your distribution (i.e. where `rector.p

```bash
# for trying out what would be done
./rector/vendor/bin/rector --dry-run
./bin/rector --dry-run

# for running the migrations
./rector/vendor/bin/rector
./bin/rector
```

---

# Developing Rector Rules for Neos
Expand All @@ -77,58 +78,13 @@ The test setup runs completely self contained; does not need *any* Distribution

```bash
# if inside a Neos Distribution, change to the Package's folder
cd rector
cd Packages/Libraries/neos/rector

# install PHPunit
composer install

# run PHPUnit
composer test
```

## Fusion Rector

We extended Rector specifically for migrating Fusion files, by providing a `FusionFileProcessor` and a `FusionRectorInterface`
which you can implement if you want to build Fusion transformations.

The Fusion Rectors will usually use one of the following tooling classes:

- `EelExpressionTransformer`: for finding all Eel expressions inside Fusion and AFX; and transforming them in some way.

The Fusion and AFX Parsing functionality is based on the official Fusion and AFX parsers. However, the classes are
vendored/copied into this package by the `./embed-fusion-and-afx-parsers.sh` script, because of the following reasons:

- Rector needs to run even when Flow cannot compile the classes; so we cannot depend on a Flow package.
- We slightly need to patch the AFX parser, because we need position information for Eel Expressions.

The Fusion parser was subclassed by `Neos\Rector\Core\FusionProcessing\CustomObjectTreeParser` for retaining position
information of AFX and Eel Expressions.


**Updating Fusion and AFX Parser**

To update the vendored Fusion and AFX parsers, run the `./embed-fusion-and-afx-parsers.sh` script.


**Updating the AFX Parser Patch**

The AFX parser needs a custom patch (see `./scripts/afx-eel-positions.patch`) to retain positions.

To create/update this patch, do the following:

```bash
cd Packages/Neos

# apply the current patch
patch -p1 < ../../rector/scripts/afx-eel-positions.patch

# Now, do your modifications as needed.

# when you are finished, create the new patch
git diff -- Neos.Fusion.Afx/ > ../../rector/scripts/afx-eel-positions.patch

# ... and reset the code changes inside Neos.Fusion.Afx.
git restore -- Neos.Fusion.Afx/
composer tests
```

## Generating docs
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
"tests": "phpunit tests"
},
"require": {
"php": "8.0.* || 8.1.* || 8.2.* || 8.3.*",
"rector/rector": "0.15.25",
"phpstan/phpstan": "1.10.14",
"php": "^8.3",
"rector/rector": "^2.0",
"symfony/yaml": "*",
"neos/utility-arrays": "*",
"webmozart/assert": "^1.11"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symplify/rule-doc-generator": "^11.1"
"phpunit/phpunit": "^12.0",
"symplify/rule-doc-generator": "^12.2"
}
}
Loading