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.
format_string() was obsoleted more than a year ago (see New SafeMarkup and HTML utility components replace check_plain(), format_string(), drupal_placeholder()), and is now officially deprecated (#2221771: Mark all simple wrappers in bootstrap.inc and common.inc as deprecated)
The attached patch changes the SimpleTest documentation comments to reflect that code should now use SafeMarkup::format() instead of format_string() in assert messages.
The patch changes this boilerplate documentation on 43 functions:
* @param $message
* (optional) A message to display with the assertion. Do not translate
- * messages: use format_string() to embed variables in the message text, not
- * t(). If left blank, a default message will be displayed.
+ * messages: use \Drupal\Component\Utility\SafeMarkup::format() to embed
+ * variables in the message text, not t(). If left blank, a default message
+ * will be displayed.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2555169-3.patch | 34.39 KB | TR |
format-string.patch | 32.67 KB | TR | |
Comments
Comment #2
TR CreditAttribution: TR commentedComment #3
TR CreditAttribution: TR commentedcore/modules/views/src/Tests/Handler/FieldKernelTest.php also uses the same boilerplate documentation. This new patch fixes that as well.
Comment #4
jhodgdonLooks good, thanks!
Comment #5
webchickActually, I'm not sure whether even SafeMarkup::format() is long for this world anymore with the stuff happening in #2549943: [plan] Remove as much of the SafeMarkup class's methods as possible. Shooting over to @alexpott.
Comment #6
jhodgdonWe need to have *some* way to do "Insert some variables into text" I think?
Comment #7
alexpottCommitted c5dbd43 and pushed to 8.0.x. Thanks!