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.
The date.formatter service implements the DateFormatterInterface therefore we should type hint against that and not DateFormatter.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2649892.4.patch | 4.07 KB | alexpott |
#4 | 1-4-interdiff.txt | 2.63 KB | alexpott |
twig-extension-date-formatter-interface.patch | 1.17 KB | mikey_p | |
Comments
Comment #2
star-szrYup I don't see why not, thanks!
Comment #3
alexpottYep this makes sense but we should also fix core/modules/node/src/Form/NodeRevisionRevertForm.php and core/modules/node/src/Form/NodeRevisionRevertTranslationForm.php as well - both typehint against DateFormatter as well. See https://www.drupal.org/core/scope for guidelines and examples for Drupal core issue scope.
Comment #4
alexpottHere it is...
Comment #5
joelpittetThanks @alexpott, back to RTBC
Comment #6
star-szrAwesome thanks @alexpott!
Comment #8
joelpittetTestbot lost the database.
Comment #10
catchCommitted/pushed to 8.1.x, thanks!
There is theoretical breakage here if someone is overriding the method with the current type hint and doesn't update it to the interface. However it's an E_STRICT warning, not fatal, and we don't expect people to extend these methods. If that turns out not to be the case, there's time to revert before 8.1.0