diff --git a/core/includes/common.inc b/core/includes/common.inc
index ab11ddf..6bef577 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4573,7 +4573,7 @@ function drupal_render_cache_by_query($query, $function, $expire = Cache::PERMAN
  *   $granularity was passed in, more parts are added.
  */
 function drupal_render_cid_parts($granularity = NULL) {
-  global $theme, $base_root, $user;
+  global $theme, $base_root;
 
   $cid_parts[] = $theme;
 
@@ -4590,10 +4590,10 @@ function drupal_render_cid_parts($granularity = NULL) {
     // resource drag for sites with many users, so when a module is being
     // equivocal, we favor the less expensive 'PER_ROLE' pattern.
     if ($granularity & DRUPAL_CACHE_PER_ROLE) {
-      $cid_parts[] = 'r.' . implode(',', $user->getRoles());
+      $cid_parts[] = 'r.' . implode(',', \Drupal::currentUser()->getRoles());
     }
     elseif ($granularity & DRUPAL_CACHE_PER_USER) {
-      $cid_parts[] = 'u.' . $user->id();
+      $cid_parts[] = 'u.' . \Drupal::currentUser()->id();
     }
 
     if ($granularity & DRUPAL_CACHE_PER_PAGE) {
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 6b75250..92f0104 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -2723,7 +2723,7 @@ function install_configure_form_submit($form, &$form_state) {
   $account->pass = $form_state['values']['account']['pass'];
   $account->name = $form_state['values']['account']['name'];
   $account->save();
-  // Load global $user and perform final login tasks.
+  // Load current user and perform final login tasks.
   $account = user_load(1);
   user_login_finalize($account);
 
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 7ad60e5..ed58dbc 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -88,7 +88,7 @@ function drupal_theme_access($theme) {
  * Initializes the theme system by loading the theme.
  */
 function drupal_theme_initialize() {
-  global $theme, $user, $theme_key;
+  global $theme, $theme_key;
 
   // If $theme is already set, assume the others are set, too, and do nothing
   if (isset($theme)) {
@@ -1749,8 +1749,7 @@ function theme_table($variables) {
  */
 function theme_mark($variables) {
   $type = $variables['status'];
-  global $user;
-  if ($user->isAuthenticated()) {
+  if (\Drupal::currentUser()->isAuthenticated()) {
     if ($type == MARK_NEW) {
       return ' <span class="marker">' . t('new') . '</span>';
     }
diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php
index 5bdf61c..a2aa7d8 100644
--- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php
@@ -78,13 +78,13 @@ public function onException(GetResponseForExceptionEvent $event) {
    * {@inheritdoc}
    *
    * The priority for request must be higher than the highest event subscriber
-   * accessing the global $user.
+   * accessing the current user.
    * The priority for the response must be as low as possible allowing e.g the
    * Cookie provider to send all relevant session data to the user.
    */
   public static function getSubscribedEvents() {
     // Priority must be higher than LanguageRequestSubscriber as LanguageManager
-    // access global $user in case language module enabled.
+    // access current user in case language module enabled.
     $events[KernelEvents::REQUEST][] = array('onKernelRequestAuthenticate', 300);
     $events[KernelEvents::RESPONSE][] = array('onRespond', 0);
     $events[KernelEvents::EXCEPTION][] = array('onException', 0);
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index 0678654..885a87b 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -28,7 +28,7 @@ class MessageFormController extends ContentEntityFormController {
    * Overrides Drupal\Core\Entity\EntityFormController::form().
    */
   public function form(array $form, array &$form_state) {
-    global $user;
+    $user = \Drupal::currentUser();
     $message = $this->entity;
     $form = parent::form($form, $form_state, $message);
     $form['#attributes']['class'][] = 'contact-form';
@@ -139,7 +139,7 @@ public function preview(array $form, array &$form_state) {
    * Overrides Drupal\Core\Entity\EntityFormController::save().
    */
   public function save(array $form, array &$form_state) {
-    global $user;
+    $user = \Drupal::currentUser();
 
     $language_interface = \Drupal::languageManager()->getCurrentLanguage();
     $message = $this->entity;
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
index 3e045d5..66849a7 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldWidget/AutocompleteWidgetBase.php
@@ -71,8 +71,6 @@ public function settingsSummary() {
    * {@inheritdoc}
    */
   public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
-    global $user;
-
     $entity = $items->getEntity();
 
     // Prepare the autocomplete route parameters.
@@ -96,7 +94,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
       '#size' => $this->getSetting('size'),
       '#placeholder' => $this->getSetting('placeholder'),
       '#element_validate' => array(array($this, 'elementValidate')),
-      '#autocreate_uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : $user->id(),
+      '#autocreate_uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : \Drupal::currentUser()->id(),
     );
 
     return array('target_id' => $element);
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
index 43fd7ee..fbd4461 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionSortTest.php
@@ -120,7 +120,7 @@ public function testSort() {
 
     // Test as a non-admin.
     $normal_user = $this->drupalCreateUser(array('access content'));
-    $GLOBALS['user'] = $normal_user;
+    $this->container->set('current_user', $normal_user);
 
     $handler = $this->container->get('plugin.manager.entity_reference.selection')->getSelectionHandler($instance);
 
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 2b09ea7..a97435a 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -466,7 +466,7 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE,
  *   The expanded element.
  */
 function filter_process_format($element) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // Ensure that children appear as subkeys of this element.
   $element['#tree'] = TRUE;
@@ -639,9 +639,7 @@ function filter_form_access_denied($element) {
  *   - id: Filter ID.
  */
 function _filter_tips($format_id, $long = FALSE) {
-  global $user;
-
-  $formats = filter_formats($user);
+  $formats = filter_formats(\Drupal::currentUser());
 
   $tips = array();
 
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
index c6c7636..865704d 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
@@ -58,7 +58,7 @@ protected function setUp() {
     // Create a test entity to serialize.
     $this->values = array(
       'name' => $this->randomName(),
-      'user_id' => $GLOBALS['user']->id(),
+      'user_id' => \Drupal::currentUser()->id(),
       'field_test_text' => array(
         'value' => $this->randomName(),
         'format' => 'full_html',
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
index e1bcc90..d55aa09 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
@@ -965,8 +965,10 @@ protected function beforePrepareEnvironment() {
    * @see TestBase::beforePrepareEnvironment()
    */
   private function prepareEnvironment() {
-    global $user;
 
+    global $conf;
+
+    $user = \Drupal::currentUser();
     // Allow (base) test classes to backup global state information.
     $this->beforePrepareEnvironment();
 
@@ -1005,9 +1007,6 @@ private function prepareEnvironment() {
     // Ensure that the current session is not changed by the new environment.
     require_once DRUPAL_ROOT . '/' . settings()->get('session_inc', 'core/includes/session.inc');
     drupal_save_session(FALSE);
-    // Run all tests as a anonymous user by default, web tests will replace that
-    // during the test set up.
-    $user = drupal_anonymous_user();
 
     // Save and clean the shutdown callbacks array because it is static cached
     // and will be changed by the test run. Otherwise it will contain callbacks
@@ -1067,7 +1066,10 @@ private function prepareEnvironment() {
 
     $request = Request::create('/');
     $this->container->set('request', $request);
-    $this->container->set('current_user', $GLOBALS['user']);
+
+    // Run all tests as a anonymous user by default, web tests will replace that
+    // during the test set up.
+    $this->container->set('current_user', drupal_anonymous_user());
 
     \Drupal::setContainer($this->container);
 
@@ -1122,9 +1124,9 @@ protected function rebuildContainer($environment = 'testing') {
     // DrupalKernel replaces the container in \Drupal::getContainer() with a
     // different object, so we need to replace the instance on this test class.
     $this->container = \Drupal::getContainer();
-    // The global $user is set in TestBase::prepareEnvironment().
+    // The current user is set in TestBase::prepareEnvironment().
     $this->container->set('request', $request);
-    $this->container->set('current_user', $GLOBALS['user']);
+    $this->container->set('current_user', \Drupal::currentUser());
   }
 
   /**
@@ -1145,7 +1147,8 @@ protected function tearDown() {
    * @see TestBase::prepareEnvironment()
    */
   private function restoreEnvironment() {
-    global $user;
+
+    global $conf;
 
     // Reset all static variables.
     // Unsetting static variables will potentially invoke destruct methods,
@@ -1230,7 +1233,7 @@ private function restoreEnvironment() {
     $callbacks = $this->originalShutdownCallbacks;
 
     // Restore original user session.
-    $user = $this->originalUser;
+    $this->container->set('current_user', $this->originalUser);
     drupal_save_session(TRUE);
   }
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index a442dd0..b3a463a 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -278,7 +278,7 @@ protected function drupalCreateNode(array $settings = array()) {
         $settings['uid'] = $this->loggedInUser->id();
       }
       else {
-        $user = \Drupal::currentUser() ?: $GLOBALS['user'];
+        $user = \Drupal::currentUser() ?: drupal_anonymous_user();
         $settings['uid'] = $user->id();
       }
     }
@@ -641,7 +641,7 @@ protected function checkPermissions(array $permissions, $reset = FALSE) {
    * If a user is already logged in, then the current user is logged out before
    * logging in the specified user.
    *
-   * Please note that neither the global $user nor the passed-in user object is
+   * Please note that neither the current user nor the passed-in user object is
    * populated with data of the logged in user. If you need full access to the
    * user object after logging in, it must be updated manually. If you also need
    * access to the plain-text password of the user (set by drupalCreateUser()),
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 915e71f..ed4cc07 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -349,7 +349,7 @@ public function validate(array $form, array &$form_state) {
 
       if ($mail_taken) {
         // Format error message dependent on whether the user is logged in or not.
-        if ($GLOBALS['user']->isAuthenticated()) {
+        if (\Drupal::currentUser()->isAuthenticated()) {
           $this->setFormError('mail', $form_state, $this->t('The e-mail address %email is already taken.', array('%email' => $mail)));
         }
         else {
diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php
index 44bce77..438ec0e 100644
--- a/core/modules/user/lib/Drupal/user/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Entity/User.php
@@ -121,7 +121,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
       // user and recreate the current one.
       if ($this->pass->value != $this->original->pass->value) {
         drupal_session_destroy_uid($this->id());
-        if ($this->id() == $GLOBALS['user']->id()) {
+        if ($this->id() == \Drupal::currentUser()->id()) {
           drupal_session_regenerate();
         }
       }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
index b404ba0..75fa5f5 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
@@ -60,7 +60,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function executeMultiple(array $entities) {
-    $this->tempStoreFactory->get('user_user_operations_cancel')->set($GLOBALS['user']->id(), $entities);
+    $this->tempStoreFactory->get('user_user_operations_cancel')->set(\Drupal::currentUser()->id(), $entities);
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
index e763bae..f1d987b 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
@@ -10,7 +10,7 @@
 use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
 
 /**
- * Default argument plugin to extract the global $user
+ * Default argument plugin to extract the current user
  *
  * This plugin actually has no options so it odes not need to do a great deal.
  *
@@ -22,8 +22,7 @@
 class CurrentUser extends ArgumentDefaultPluginBase {
 
   public function getArgument() {
-    global $user;
-    return $user->id();
+    return \Drupal::currentUser()->id();
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
index d385236..d7c3701 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
@@ -109,21 +109,21 @@ public function validateArgument($argument) {
     // However, is_integer() will always fail, since $argument is a string.
     if (is_numeric($argument) && $argument == (int)$argument) {
       if ($type == 'uid' || $type == 'either') {
-        if ($argument == $GLOBALS['user']->id()) {
+        if ($argument == \Drupal::currentUser()->id()) {
           // If you assign an object to a variable in PHP, the variable
           // automatically acts as a reference, not a copy, so we use
           // clone to ensure that we don't actually mess with the
-          // real global $user object.
-          $account = clone $GLOBALS['user'];
+          // real current user object.
+          $account = clone \Drupal::currentUser();
         }
         $condition = 'uid';
       }
     }
     else {
       if ($type == 'name' || $type == 'either') {
-        $name = $GLOBALS['user']->getUserName() ?: \Drupal::config('user.settings')->get('anonymous');
+        $name = \Drupal::currentUser()->getUserName() ?: \Drupal::config('user.settings')->get('anonymous');
         if ($argument == $name) {
-          $account = clone $GLOBALS['user'];
+          $account = clone \Drupal::currentUser();
         }
         $condition = 'name';
       }
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index c9f1f1d..32a7922 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -41,7 +41,7 @@ public function form(array $form, array &$form_state) {
 
     // If we aren't admin but already logged on, go to the user page instead.
     if (!$admin && $user->isAuthenticated()) {
-      return new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE)));
+      return new RedirectResponse(url('user/' . \Drupal::currentUser()->id(), array('absolute' => TRUE)));
     }
 
     $form['#attached']['library'][] = array('core', 'jquery.cookie');
diff --git a/core/modules/user/lib/Drupal/user/TempStoreFactory.php b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
index 45f421e..28d4147 100644
--- a/core/modules/user/lib/Drupal/user/TempStoreFactory.php
+++ b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
@@ -61,7 +61,7 @@ function get($collection, $owner = NULL) {
     // Use the currently authenticated user ID or the active user ID unless
     // the owner is overridden.
     if (!isset($owner)) {
-      $owner = $GLOBALS['user']->id() ?: session_id();
+      $owner = \Drupal::currentUser()->id() ?: session_id();
     }
 
     // Store the data for this collection in the database.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index d16b4e2..991ac35 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -57,7 +57,7 @@ function testUserTokenReplacement() {
     $this->drupalLogin($user2);
 
     $account = user_load($user1->id());
-    $global_account = user_load($GLOBALS['user']->id());
+    $global_account = user_load(\Drupal::currentUser()->id());
 
     // Generate and test sanitized tokens.
     $tests = array();
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index c8b51b7..ccae145 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -958,8 +958,6 @@ function user_pass_rehash($password, $timestamp, $login) {
  * @see _user_cancel()
  */
 function user_cancel($edit, $uid, $method) {
-  global $user;
-
   $account = user_load($uid);
 
   if (!$account) {
@@ -992,7 +990,7 @@ function user_cancel($edit, $uid, $method) {
   );
 
   // After cancelling account, ensure that user is logged out.
-  if ($account->id() == $user->id()) {
+  if ($account->id() == \Drupal::currentUser()->id()) {
     // Batch API stores data in the session, so use the finished operation to
     // manipulate the current user's session id.
     $batch['finished'] = '_user_cancel_session_regenerate';
@@ -1569,8 +1567,6 @@ function user_form_process_password_confirm($element) {
   );
 
   if (\Drupal::config('user.settings')->get('password_strength')) {
-
-    global $user;
     $password_settings['showStrengthIndicator'] = TRUE;
     $password_settings += array(
       'strengthTitle' => t('Password strength:'),
@@ -1585,7 +1581,7 @@ function user_form_process_password_confirm($element) {
       'fair' => t('Fair'),
       'good' => t('Good'),
       'strong' => t('Strong'),
-      'username' => $user->getUsername(),
+      'username' => \Drupal::currentUser()->getUsername(),
     );
   }
 
@@ -1671,7 +1667,7 @@ function user_file_download_access($field, EntityInterface $entity, File $file)
  * Implements hook_toolbar().
  */
 function user_toolbar() {
-  global $user;
+  $user = \Drupal::currentUser();
 
   // Add logout & user account links or login link.
   if ($user->isAuthenticated()) {
@@ -1745,7 +1741,7 @@ function user_toolbar() {
  * Logs the current user out.
  */
 function user_logout() {
-  global $user;
+  $user = \Drupal::currentUser();
 
   watchdog('user', 'Session closed for %name.', array('%name' => $user->getUsername()));
 
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index 5412a38..e3c22f2 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -125,7 +125,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
   }
 
   if ($type == 'current-user') {
-    $account = user_load($GLOBALS['user']->id());
+    $account = user_load(\Drupal::currentUser()->id());
     $replacements += $token_service->generate('user', $tokens, array('user' => $account), $options);
   }
 
diff --git a/core/modules/user/user.views_execution.inc b/core/modules/user/user.views_execution.inc
index 622cdbf..c9a3f1d 100644
--- a/core/modules/user/user.views_execution.inc
+++ b/core/modules/user/user.views_execution.inc
@@ -13,6 +13,5 @@
  * Allow replacement of current userid so we can cache these queries.
  */
 function user_views_query_substitutions(ViewExecutable $view) {
-  global $user;
-  return array('***CURRENT_USER***' => $user->id());
+  return array('***CURRENT_USER***' => \Drupal::currentUser()->id());
 }
