Needs review
Project:
Drupal core
Version:
main
Component:
other
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Aug 2026 at 19:27 UTC
Updated:
14 Sep 2026 at 22:53 UTC
Jump to comment: Most recent
The cast here does nothing: https://git.drupalcode.org/project/drupal/-/blob/00dfe3f40fe48e25a7b9a4c...
DateTimePlus::render() always returns a string (although it does not have a return type declaration).
It was introduced by #3548957: Deprecate ToStringTrait because the method was copied from ToStringTrait.
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 #3
bt dev2 commentedI removed the unnecessary cast from DateTimePlus's __toString() method.
I noticed the render() method itself doesn't have a : string return type declared. Do we need to add a : string there?
Comment #5
smustgrave commentedLooking at #3548957: Deprecate ToStringTrait
core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.phpalso appears to have a redundant typecast that could be removedComment #6
bt dev2 commentedRemoved redundant typecast from TranslatableMarkup::__toString()
Comment #7
smustgrave commentedphpstorm definitely flagged it as redundant but get a test failure so maybe it was wrong?
Comment #8
prudloff commentedThis probably means the type we document in the docblock is not always respected.
Comment #11
smustgrave commented@zeeshan_khan can you please stop going around opening MRs where ones already exist please.
Comment #12
zeeshan_khan commented@smustgrave You're right, I shouldn't have opened a second MR - sorry about that. Closing mine. One thing worth flagging on !16827 itself: it also touched TranslatableMarkup::__toString(), which is what broke LinkBaseTest - that part might be worth dropping from !16827 and tracking separately." Post that as a comment on !16827 or the issue, not as its own MR.
Comment #13
quietone commentedThe title doesn't make sense to me.
Comment #14
prudloff commentedI reverted the title.