Problem/Motivation
Following #2917331: Decouple from Symfony CMF we can simplify the implementation of, and reduce the API surface of, methods in UrlGenerator that accept both a route name and route object.
Examples:
UrlGenerator::getPathFromRoute()
UrlGenerator::generateFromRoute()
(also supporting protected methods)
In Drupal 10, this would also allow us to string typehint for those methods too.
Proposed resolution
Trigger a deprecation message when a route object is passed in.
Remaining tasks
While there's not a strict dependency in either direction, this issue is closely linked to #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage().