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

[RFC] Remove the *.class parameters #106

Closed
takeit opened this issue Aug 11, 2016 · 1 comment
Closed

[RFC] Remove the *.class parameters #106

takeit opened this issue Aug 11, 2016 · 1 comment

Comments

@takeit
Copy link
Contributor

takeit commented Aug 11, 2016

Here is an issue describing why it was done: symfony/symfony#11881

All services in core define their classes as parameters. The convention is to create a foo.class parameter for the class of the foo service. This approach comes with several problems:

The parameters are dumped like any other one in the compiled class and it makes the file larger for no good reasons (read: it slows down your app for free).

When someone wants to change a service, just changing the class name is rarely enough: the new service probably have some different constructor arguments, ... Or put another way, overriding a service by just changing the class name of a service is a very rare use case.

Of course, if several bundles change the value of such a parameter, the "last" definition wins. Classic inheritance vs composition problem.

For all these reasons, I like to remove all those parameters for Symfony 3.0.

On a side note, it's now possible to easily replace a service by decorating it (see symfony/symfony#9003).

There is also a script that Fabien used to do it (for xml files) symfony/symfony#14070 (comment)

All those parameters have been removed already in Symfony 3.0.

@takeit takeit added the RFC label Aug 11, 2016
@ahilles107
Copy link
Contributor

👍

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

No branches or pull requests

2 participants