diff -u b/core/lib/Drupal/Core/Session/AccountInterface.php b/core/lib/Drupal/Core/Session/AccountInterface.php --- b/core/lib/Drupal/Core/Session/AccountInterface.php +++ b/core/lib/Drupal/Core/Session/AccountInterface.php @@ -109,11 +109,11 @@ * Returns the username of this account. * * @return - * An unsanitized string with the username to display. + * An unsanitized plain-text string with the username to display. * * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. * Use Drupal\Core\Session\AccountInterface::getAccountName() or - * \Drupal\user\RoleInterface::getDisplayName8) instead. + * \Drupal\user\RoleInterface::getDisplayName() instead. */ public function getUsername(); @@ -121,7 +121,7 @@ * Returns the unaltered name of this account. * * @return - * An unsanitized string with the username to display. + * An unsanitized plain-text string with the username to display. */ public function getAccountName(); @@ -129,15 +129,16 @@ * Returns the display name of this account. * * By default, the passed-in object's 'name' property is used if it exists, or - * else, the site-defined value for the 'anonymous' variable. However, a module - * may override this by implementing + * else, the site-defined value for the 'anonymous' variable. However, a + * module may override this by implementing * hook_user_format_name_alter(&$name, $account). * * @see hook_user_format_name_alter() * * @return string|\Drupal\Component\Utility\SafeStringInterface - * Either a string that will be autoescaped or a SafeString object that is - * already escaped. Both are safe to be printed. + * Either a string that will be auto-escaped on output or a + * SafeStringInterface object that is already HTML escaped. Either is safe + * to be printed within HTML fragments. */ public function getDisplayName(); diff -u b/core/modules/user/user.api.php b/core/modules/user/user.api.php --- b/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -107,12 +107,12 @@ /** * Alter the username that is displayed for a user. * - * Called by $user->getDisplayName() to allow modules to alter the username that's - * displayed. Can be used to ensure user privacy in situations where + * Called by $account->getDisplayName() to allow modules to alter the username + * that is displayed. Can be used to ensure user privacy in situations where * $account->name is too revealing. * * @param string $name - * The string that $user->getDisplayName() will return. + * The string that $account->getDisplayName() will return. * * @param $account * The account object passed to user_format_name().