- π©πͺGermany donquixote
Hello,
it makes sense to remove compiler passes that are purely for optimization, and that don't change behavior.However, the RemoveUnusedDefinitionsPass is not designed purely for optimization.
In a symfony project, the following use case is typical:
- Scan a directory and register every class as a private service. This will include classes that absolutely cannot be used as services.
- Process all the services with autowire, autoconfigure etc. This will also populate the error list for broken services.
- Remove unused private services. This will usually get rid of the broken services that were added earlier.This means RemoveUnusedDefinitionsPass is essential if we have any mechanism that adds random classes as private services.
If we don't have this mechanism, then we never need it: Not during the installer, but also not really later.I mention all this because I am currently experimenting with service discovery.