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
__toString was removed from Url as we couldn't throw exceptions inside __toString (#2416971: Remove Url::__toString()), before we added ToStringTrait in #2562487: Get better error reporting from __toString.
Proposed resolution
Add ToStringTrait to Url
Remaining tasks
Write tests
Review
Commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
credit: tim.plunkett
Comment | File | Size | Author |
---|---|---|---|
tostring.patch | 813 bytes | stefan.r | |
Comments
Comment #2
dawehnerConceptually I kinda dislike to start the entire URL rendering process by accident (by casting it to a string) basically. Making things more explicit is often a better idea.
Comment #3
dawehnerSo thoughts about explicit vs. implicit here?
Comment #4
markdorison@dawehner What do you have in mind for a more explicit approach?