Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Follow-up to #3339710: Disallow passing route objects to UrlGenerator methods to remove the deprecations.
Proposed resolution
Remove deprecattions from:
- #3151017: Deprecate UrlGenerator::supports() and UrlGenerator::getRouteDebugMessage()
- #3151019: Only allow route names, deprecate support for route objects in UrlGenerator methods
Add string
type to $name
argument of \Drupal\Core\Routing\UrlGeneratorInterface
Remaining tasks
- remove deprecations
- patch&review&commit
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3425294
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
thhomas CreditAttribution: thhomas commentedremoved deprecation test
Comment #6
mstrelan CreditAttribution: mstrelan at PreviousNext commentedComment #7
thhomas CreditAttribution: thhomas as a volunteer commentedComment #8
smustgrave CreditAttribution: smustgrave at Mobomo commentedRemoval appears to be correct.
Thought about expanding this to include all deprecation in Routing but that would be a lot. This is well scoped.
Comment #9
catchOne question on the MR.
Comment #10
thhomas CreditAttribution: thhomas as a volunteer commentedComment #11
smustgrave CreditAttribution: smustgrave at Mobomo commented@thhomas could you answer the question though. Was suggested to open a follow up and maybe throw an exception.
Comment #12
longwaveGiven we already did the deprecation I think we can just add the string type here, I don't see the need to defer that to a different issue.
Comment #13
catchYeah #12 makes sense to me, wish I'd thought of that in the first place.
Comment #14
longwaveFixed the above, also taken the liberty here to add
array
types where necessary and also implement all types that are present on the Symfony interfaces; if you were mismatching types here before you were doing something wrong already, so better to catch this in the method call than crash or do something unexpected later on.Comment #15
smustgrave CreditAttribution: smustgrave at Mobomo commentedSeems to have a Unit test failures.
Comment #16
longwaveFixed, we extend
::generate()
so it can take boolean as well as int in the third argument, fixed the signature here so this is allowed.Comment #17
smustgrave CreditAttribution: smustgrave at Mobomo commentedRemoval seems good now.
Comment #19
catchYes this looks great, glad we added the type hints here.
Committed/pushed to 11.x, thanks!