Skip to content

[Config] Make rector.php extensible instead of fully replaceable#17

Closed
coisa wants to merge 2 commits intomainfrom
feature/issue-7-extensible-rector-config
Closed

[Config] Make rector.php extensible instead of fully replaceable#17
coisa wants to merge 2 commits intomainfrom
feature/issue-7-extensible-rector-config

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 9, 2026

Summary

  • Introduced RectorConfigFactory class with configure() and configureWithWorkingDirectory() methods
  • Updated rector.php to return configuration closure for consumer extensibility
  • Added usage examples in docblocks for require + extend pattern
  • Added tests for RectorConfigFactory

Implementation

The solution provides multiple ways for consumers to extend the Rector configuration:

  1. Direct usage: return require __DIR__ . '/vendor/fast-forward/dev-tools/rector.php';
  2. Factory pattern:
    return static function (RectorConfig $rectorConfig): void {
        RectorConfigFactory::configure($rectorConfig);
        // Add custom configuration
    };
  3. Extend with custom rules:
    $configure = require __DIR__ . '/vendor/fast-forward/dev-tools/rector.php';
    return static function (RectorConfig $rectorConfig) use ($configure): void {
        $configure($rectorConfig);
        $rectorConfig->rules([CustomRule::class]);
    };

This allows consumers to build on top of the base configuration without copying the entire file, preserving the ability to receive upstream updates automatically.

Closes #7

coisa added 2 commits April 8, 2026 22:34
- Introduce EcsConfigFactory class with create() and loadBaseConfiguration() methods
- Update ecs.php to return ECSConfigBuilder directly for consumer extensibility
- Add usage examples in docblocks for require + extend pattern
- Add tests for EcsConfigFactory

Implements: #6
- Introduce RectorConfigFactory class with configure() and configureWithWorkingDirectory() methods
- Update rector.php to return configuration closure for consumer extensibility
- Add usage examples in docblocks for require + extend pattern
- Add tests for RectorConfigFactory

Implements: #7
@coisa coisa closed this Apr 9, 2026
@coisa coisa deleted the feature/issue-7-extensible-rector-config branch April 9, 2026 01:53
@coisa
Copy link
Copy Markdown
Contributor Author

coisa commented Apr 9, 2026

Closing this PR because the changes introduced here became inconsistent and hard to review due to issues in the automated generation process.

Instead of trying to fix this incrementally, the work will be redone in a clean, focused follow-up PR to ensure better structure, clarity, and reviewability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make rector.php extensible instead of fully replaceable

1 participant