Problem/Motivation
We have Symfony CMF as a dependency, but we only really use four things from it:
RouteEnhancerInterface
RouteFilterInterface
Also the ROUTE_NAME and ROUTE_OBJECT constants from RouteObjectInterface
And the LazyRouteCollection class - which has a handful of very short methods.
Proposed resolution
Copy LazyRouteCollection to Drupal\Core\Routing and Drupalize it - this is the only logic from Symfony CMF we actually use at this point except maybe one or two small methods, and it's a very simple class.
Create our own version of RouteObjectInterface which just contains the ROUTE_NAME, ROUTE_OBJECT and CONTROLLER constants, then convert code to use those.
Where our interfaces extend from Symfony CMF interfaces, add the inherited methods to our own interfaces.
Remove all usages of PagedRouteCollection, deprecated the getRoutesPaged() method.
After this we'll have no direct dependencies on Symfony CMF routing, and could remove the dependency in 10.0.0
Two follow-ups are opened, for further deprecations and API tightening that this patch enables:
#3151017: [PP-1] Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage() and #3151019: Only allow route names, deprecate support for route objects in UrlGenerator methods
Remaining tasks
User interface changes
API changes
Drupal\Core\Routing\RouteObjectInterface
has been added to provide two constants previously provided by Symfony\Cmf\Component\Routing\RouteObjectInterface
Drupal\Core\Routing\UrlGeneratorInterface
no longer extends Symfony\Cmf\Component\Routing\VersatileGeneratorInterface.
Data model changes
Release notes snippet
Drupal 10 will no longer depend on symfony/cmf. Code referencing the constants on RouteObjectInterface will need to reference the Drupal core version, see https://www.drupal.org/node/3151009