Problem/Motivation
This string should not be passed through the translation system. It should maybe be FormattableMarkup. Needs a follow-up filed to fix and discuss.
from alexpott in https://git.drupalcode.org/project/drupal/-/merge_requests/8393/diffs#no...
From core/lib/Drupal/Core/Form/ConfigFormBase.php,
$this->t(implode("\n", $transformed_message_parts));
$this->t(implode("\n", $transformed_message_parts)); shouldn't be use t(). Instead, it should be handled as FormattableMarkup() to ensure proper handling of content and prevent unintended translation.
Follow up from #3123067: Fix 'Drupal.Semantics.FunctionT.NotLiteralString' coding standard
Steps to reproduce
Proposed resolution
can use FormattableMarkup() instead of t(), see: core/includes/errors.inc
Remaining tasks
Investigate and decide on a course of action
Review
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3456149
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 #2
quietone commentedComment #3
quietone commentedComment #6
pooja_sharma commentedI have observed in core files (for eg. core/includes/errors.inc) instead of using translation t() can be use FormattableMarkup() (even same mentioned in MR where this issue trace out) , So replaced the t() with FormattableMarkup().
Please review , moving NR.
Comment #7
pooja_sharma commentedComment #8
smustgrave commentedCan the issue summary be updated as well please.
Thanks
Comment #9
pooja_sharma commentedAdded description , Please review &moving to NR
Comment #10
pooja_sharma commentedComment #11
smustgrave commentedMade a small tweak to the comment, pulling from the issue summary, but change seems good to me. Function being protected assuming will be non disruptive to existing forms.
Comment #12
pooja_sharma commentedRebased MR with latest code, seems working fine.
Comment #13
pooja_sharma commentedMR conflicts are visible on MR, addressed those
Rebased MR with latest code, seems working fine.
Comment #14
alexpottAdded a comment to the MR.
Comment #15
pooja_sharma commentedApplied the mentioned suggestions.
Please review, moving NR
Comment #16
pooja_sharma commentedComment #17
smustgrave commentedLeft a comment on MR.
Comment #18
pooja_sharma commentedApplied the mentioned suggestions.
Comment #19
pooja_sharma commentedPlease review, moving NR.
Comment #20
smustgrave commentedDon't have a preference over MarkupInterface or \Stringable but only one is used
Comment #21
catchOne comment on the comment. Also I think @alexpott might have been asking for a return value of MarkupInterface|Stringable?
Comment #22
pooja_sharma commentedApplied suggestion: MarkupInterface|\Stringable for return type
Please review , moving NR
Comment #23
pooja_sharma commentedComment #24
smustgrave commentedThat's my mistake @pooja_sharma. Think you had that before and had you change it as I interpreted it differently.
Comment #25
alexpottOnly committing to 11.x since the change is very minor and results in an API widening.
Committed b014318 and pushed to 11.x. Thanks!
Comment #28
gappleRan into an issue with the the return type change, since I was developing a module using the latest version of core and copied the new return type hint.
When using the new return type in an override with a stable version of core <=11.0.5, the child class is returning a wider type than it's parent.
When using the old return type in an override with 11.x-dev,
parent::formatMultipleViolationsMessage()returns a wider type than the child class.For a module to maintain compatibility with older versions of core and not break if it calls the parent method which now returns
Markup, it will need to change the value returned from its parent:Once the module drops support for older versions of core, it can update its typehint and remove the extra code.
\Drupal\update\UpdateSettingsFormalso needs its return type updated.Comment #29
gappleOpened #3481331: ConfigFormBase::formatMultipleViolationsMessage() return type change will cause error as a bug from this change.