Problem/Motivation
Core is trying to stop using FormattableMarkup (see many other issues in this one's family tree).
AssertContentTrait is full of docblocks that recommend using FormattableMarkup.
Steps to reproduce
View core/tests/Drupal/KernelTests/AssertContentTrait.php
Proposed resolution
Remove usages of FormattableMarkup.
Before
* @param string $message
* (optional) A message to display with the assertion. Do not translate
* messages: use \Drupal\Component\Render\FormattableMarkup to embed
* variables in the message text, not t(). If left blank, a default message
* will be displayed.
After
* (optional) A message to display with the assertion. Do not translate
* messages with t(). Use double quotes and embed variables directly in
* message text, or use sprintf() if necessary. Avoid the use of
* \Drupal\Component\Render\FormattableMarkup unless you cast the object to
* a string. If left blank, a default message will be displayed.
Remaining tasks
- Decide on the exact text.
- Search/replace in AssertContentTrait to update everything.
- Open an MR and push the commit that makes the changes.
- Review / refinement.
- RTBC.
- Commit.
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | tmp.sh_.txt | 882 bytes | quietone |
Issue fork drupal-3405364
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:
- 3405364-fix-usages-of
changes, plain diff MR !9273
Comments
Comment #2
mstrelan commentedIs this a duplicate of #3402707: Fix strict type errors in AssertContentTrait?
Comment #3
dwwIndeed, I'm wondering. Do we want to majorly expand the scope of that to update dozens of docblocks?
Comment #4
mstrelan commentedI think you're right. The important thing for enabling strict types is adding the casts, we can improve on docs and allowed types in this issue and / or follow ups.
Comment #5
quietone commentedComment #7
quietone commentedI think the new text is fine. I used this script to change the instances in the issue summary.
Comment #8
quietone commentedComment #9
smustgrave commentedApplied MR and searched for "use \Drupal\Component\Render\FormattableMarkup to embed" and all instances in core has been replaced.
Replacement also reads well.
Comment #11
nod_Committed and pushed 19b213dbef to 11.x and 0a510d5c05 to 11.0.x and ca5b45e08a to 10.4.x and c3fe5c10d9 to 10.3.x. Thanks!
Comment #16
nod_