symfony/symfony — Issue #2422: RouterCacheWarmer should not typehint Symfony\Component\Routing\Router
Author: dbu
Created: 2011-10-17 20:19:26+00:00
State: open

while trying to replace the symfony router component with a special implementation [1], i failed on the RouterCacheWarmer typehinting a specific Router implementation.
the RouterInterface does not specify the methods required for the RouterCacheWarmer. I would suggest we have an interface (maybe CacheWarmingEnabledInterface?).
And i would propose to make RouterCacheWarmer optional so people *can* use a router that does not implement the interface. To get there, either there needs to be a way to disable the RouterCacheWarmer or the service could not typehint anything and check the argument whether it is instanceof CacheWarmingEnabledInterface and do nothing if the interface is not set. The later is hard to debug though.

I am happy to do a pull request for that, but first want to discuss if it makes sense like this, or if there are better suggestions.

[1] https://github.com/symfony-cmf/ChainRoutingBundle