diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
index 1a4981a..4635053 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
@@ -68,7 +68,7 @@ protected function textFormatHasTransformationFilters($format_id) {
    * Implements \Drupal\edit\EditPluginInterface::getAttachments().
    */
   public function getAttachments() {
-    global $user;
+    $user = \Drupal::currentUser();
 
     $user_format_ids = array_keys(filter_formats($user));
     $manager = \Drupal::service('plugin.manager.editor');
