function UserSession::getUsername

Overrides AccountInterface::getUsername

File

core/lib/Drupal/Core/Session/UserSession.php, line 157

Class

UserSession
An implementation of the user account interface for the global user.

Namespace

Drupal\Core\Session

Code

public function getUsername() {
    @trigger_error('\\Drupal\\Core\\Session\\AccountInterface::getUsername() is deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\Session\\AccountInterface::getAccountName() or \\Drupal\\user\\UserInterface::getDisplayName() instead. See https://www.drupal.org/node/2572493', E_USER_DEPRECATED);
    return $this->getAccountName();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.