Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add withSetProviders method #6515

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ghostwriter
Copy link
Contributor

This patch resolves rectorphp/rector#8720 (comment), via the following changes:

  • Add a new withSetProviders method, to add set provider class names to the setProviders array, including validation to ensure they implement the SetProviderInterface.

  • Modified the __invoke method to handle both setGroups and setProviders when creating a SetManager instance.

<?php

declare(strict_types=1);

use Vendor\Package\RectorSetProvider;
use Vendor\Package\ComposerSetProvider;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
           ->withSetProviders(
               RectorSetProvider::class,
               ComposerSetProvider::class
           );

Note: I haven't added tests, but this can serve as a starting point, if you like the idea.

Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
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.

Feature Request: Add withSetProviders method for Registering SetProviderInterface
1 participant