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

Merged

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]>
@TomasVotruba TomasVotruba merged commit 0a6eb12 into rectorphp:main Jan 11, 2025
36 checks passed
@TomasVotruba
Copy link
Member

Thank you, looks good to me 👍

@ghostwriter ghostwriter deleted the oss/rectorphp/rector/issues/8720 branch January 11, 2025 19:02
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
3 participants