Skip to content

Add dump-config command to print the resolved configuration as JSON - #9071

Merged
TomasVotruba merged 1 commit into
mainfrom
dump-config
Nov 25, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
dump-config

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Adds vendor/bin/rector dump-config - prints the resolved rector.php as JSON, so an external runner can reuse the same config. Same idea as ecs dump-config.

vendor/bin/rector dump-config --config rector.php
{
    "php_version": 80100,
    "paths": ["/project/src"],
    "skips": [
        {"path": "/project/src/Legacy"},
        {"class": "Rector\\DeadCode\\Rector\\ClassMethod\\RemoveUnusedPrivateMethodRector", "paths": ["/project/src/Entity/*"]}
    ],
    "rules": [
        {"class": "Rector\\DeadCode\\Rector\\ClassMethod\\RemoveUnusedPrivateMethodRector", "config": null},
        {"class": "Rector\\Renaming\\Rector\\Name\\RenameClassRector", "config": {"App\\OldClass": "App\\NewClass"}},
        {"class": "Rector\\Renaming\\Rector\\MethodCall\\RenameMethodRector", "config": [
            {"@class": "Rector\\Renaming\\ValueObject\\MethodCallRename", "class": "App\\Foo", "oldMethod": "old", "newMethod": "new"}
        ]}
    ],
    "import_names": true,
    "import_short_classes": true,
    "remove_unused_imports": true
}
  • rules - every registered rule, with the configuration configure() receives; value objects are dumped with @class and their properties
  • skips - a skipped interface or parent class also lists each registered rule it covers, as the Skipper matches with is_a()
  • php_version - null unless set in the config

Prints paths, PHP version, registered rules with their configuration and skips, so external runners can reuse rector.php.
@TomasVotruba
TomasVotruba merged commit 985db83 into main Nov 25, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the dump-config branch November 25, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant