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

Proper container configurator API #1891

Closed
wants to merge 1 commit into from

Conversation

Wirone
Copy link
Contributor

@Wirone Wirone commented Mar 2, 2022

As discussed in #7035 here's implementation of RectorServiceConfigurator and rector for migrating from Symfony's one.

Rector rule

I've tested it on Rector's codebase and it works, but it's unnecessary to refactor internal code since symfony/dependency-injection is patched and locally has proper return type. Also I did not add UseRectorContainerConfiguratorRector to any rule set because I think it should be opt-in for end users (explicit use in the config). But if you would like to add it, just let me know where it should be.

@Wirone Wirone changed the title Proper container configurator api Proper container configurator API Mar 2, 2022
@Wirone Wirone force-pushed the proper-configurator-api branch from 32f9977 to c992dde Compare March 2, 2022 11:45
@Wirone
Copy link
Contributor Author

Wirone commented Mar 8, 2022

@TomasVotruba any news on this? Is there any blocker that stop you from merging this?

ecs.php Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
return static function (\Rector\Core\DependencyInjection\Loader\Configurator\RectorContainerConfigurator $containerConfigurator): void {
};

?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test fixture to skip the other non-rector configs?
We don't want to override Symfony config/services.php to Rector ones :) also ECS should be skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How it should be checked? IMHO there's no need for such fixtures since this rule is optional (I did not add it to any rule set). People who want opt-in and use it should just configure paths to ignore for this rule.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably e2e test, that single registered configured rule did some job.

*/
final class RectorContainerConfigurator extends ContainerConfigurator
{
}
Copy link
Member

@TomasVotruba TomasVotruba Mar 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find the test case, that would actually test this type in rector.php results in successfuly loaded Rector container.
Could you add one?

@TomasVotruba
Copy link
Member

@Wirone I'm a bit ill 🤒 this week, so I only got to your PR.
I've dropped few comments 👍

- Stable public API for configuring services
- Rector rule for migrating Symfony configurator to Rector configurator
@TomasVotruba
Copy link
Member

I'll look into this one today 👍

@TomasVotruba
Copy link
Member

TomasVotruba commented Apr 7, 2022

@Wirone Thank you for your work on this 👍

Continue in #2019

@Wirone Wirone deleted the proper-configurator-api branch April 8, 2022 08:00
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.

2 participants