diff --git a/README.md b/README.md
index a11575c..b3b49b8 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,8 @@ Entity Embed can be installed via the
 * Install and enable [Embed](https://www.drupal.org/project/embed) module.
 * Install and enable [Entity Embed](https://www.drupal.org/project/entity_embed)
   module.
-* Go to the 'Text formats and editors' configuration page: `/admin/config/content/formats`,
+* Go to the 'Text formats and editors' configuration
+page: `/admin/config/content/formats`,
   and for each text format/editor combo where you want to embed entities,
   do the following:
   * Enable the "Display embedded entities" filter for the desired text formats
@@ -27,7 +28,11 @@ Entity Embed can be installed via the
   * If the text format uses the 'Limit allowed HTML tags and correct
     faulty HTML' filter, ensure the necessary tags and attributes were
     automatically whitelisted:
-    ```<drupal-entity data-entity-type data-entity-uuid data-view-mode data-entity-embed-display data-entity-embed-display-settings data-align data-caption data-embed-button data-langcode alt title>```
+    ```<drupal-entity data-entity-type
+    data-entity-uuid data-view-mode
+    data-entity-embed-display data-entity-embed-display-settings
+    data-align data-caption data-embed-button
+    data-langcode alt title>```
     appears in the 'Allowed HTML tags' setting.
     *Warning: If you were using the module in very early pre-alpha
     stages you might need to add `data-entity-id` to the list of allowed
@@ -70,7 +75,11 @@ that is used to embed the actual entity.
 
 ### Example:
 ```html
-<drupal-entity data-entity-type="node" data-entity-uuid="07bf3a2e-1941-4a44-9b02-2d1d7a41ec0e" data-entity-embed-display="entity_reference:entity_reference_entity_view" data-entity-embed-display-settings='{"view_mode":"teaser"}' />
+<drupal-entity data-entity-type="node" data-entity-uuid="07bf3a2e-1941-4a44-
+9b02-2d1d7a41ec0e" data-entity-embed-
+display="entity_reference:entity_reference_
+entity_view"data-entity-embed-display-settings=
+'{"view_mode":"teaser"}' />
 ```
 
 ## Entity Embed Display Plugins
@@ -88,7 +97,7 @@ different Entity Embed Display plugins out of the box:
 - image:_formatter_id_: Renders the entity using a specific Image field
   formatter. This will only work if the entity is a file entity type,
   and the file is an image.  For the alt and title text to save, the `alt`
-  and `title` attributes must be allowed on the `<drupal-entity>` HTML tag
+  and `title` attributes must be allowed on the`<drupal-entity>` HTML tag
   in the "Allowed HTML tags" for text formats that have the "Limit allowed
   HTML tags and correct faulty HTML" filter enabled.
 
diff --git a/entity_embed.api.php b/entity_embed.api.php
index ec83c6e..793e767 100644
--- a/entity_embed.api.php
+++ b/entity_embed.api.php
@@ -40,7 +40,9 @@ function hook_entity_embed_display_plugins_for_context_alter(array &$definitions
   $entity = $contexts['entity'];
 
   // For video and audio files, limit the available options to the media player.
-  if ($entity instanceof \Drupal\file\FileInterface && in_array($entity->bundle(), ['audio', 'video'])) {
+  if ($entity instanceof
+    \Drupal\file\FileInterface &&
+    in_array($entity->bundle(), ['audio', 'video'])) {
     $definitions = array_intersect_key($definitions, array_flip(['file:jwplayer_formatter']));
   }
 
@@ -65,7 +67,7 @@ function hook_entity_embed_display_plugins_for_context_alter(array &$definitions
  */
 function hook_entity_embed_context_alter(array &$context, \Drupal\Core\Entity\EntityInterface $entity) {
   if (isset($context['overrides']) && is_array($context['overrides'])) {
-    foreach ($context['overrides'] as $key => $value) {
+    foreach ($context['overrides'] as => $value) {
       $entity->key = $value;
     }
   }
@@ -81,7 +83,7 @@ function hook_entity_embed_context_alter(array &$context, \Drupal\Core\Entity\En
  */
 function hook_ENTITY_TYPE_embed_context_alter(array &$context, \Drupal\Core\Entity\EntityInterface $entity) {
   if (isset($context['overrides']) && is_array($context['overrides'])) {
-    foreach ($context['overrides'] as $key => $value) {
+    foreach ($context['overrides'] as => $value) {
       $entity->key = $value;
     }
   }
diff --git a/entity_embed.module b/entity_embed.module
index 2889c50..d1c8f0c 100644
--- a/entity_embed.module
+++ b/entity_embed.module
@@ -152,7 +152,7 @@ function entity_embed_filter_format_edit_form_validate($form, FormStateInterface
     'status',
   ]);
 
-  if ($entity_embed_enabled && $filter_html_enabled && $allowed_html = $form_state->getValue($allowed_html_path)) {
+  if ($entity_embed_enabled && $filter_html_enabled && (NULL !== $form_state->getValue($allowed_html_path))) {
     if ($button_groups = $form_state->getValue($button_group_path)) {
       $buttons = [];
       $button_groups = json_decode($button_groups, TRUE);
diff --git a/js/entity_embed.dialog.js b/js/entity_embed.dialog.js
index 59ace62..14b6912 100644
--- a/js/entity_embed.dialog.js
+++ b/js/entity_embed.dialog.js
@@ -47,7 +47,7 @@
       $(this).attr('target', '_blank');
       window.open(this.href, 'entityPreview', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1');
     },
-    selectionCompleted: function(event, uuid, entities) {
+    selectionCompleted: function (event, uuid, entities) {
       $('.entity-select-dialog .js-button-next').click();
     }
   };
diff --git a/js/plugins/drupalentity/plugin.js b/js/plugins/drupalentity/plugin.js
index 58a1e81..41cebcc 100644
--- a/js/plugins/drupalentity/plugin.js
+++ b/js/plugins/drupalentity/plugin.js
@@ -14,7 +14,7 @@
       return widget;
     }
 
-    return null;
+    return NULL;
   }
 
   function linkCommandIntegrator(editor) {
@@ -29,7 +29,7 @@
         return;
       }
 
-      widget.setData('link', null);
+      widget.setData('link', NULL);
 
       this.refresh(editor, editor.elementPath());
 
@@ -76,7 +76,7 @@
         } else {
           // drupallink has a hardcoded integration with drupalimage. Workaround
           // that, to reuse the same integration.
-          var originalGetFocusedWidget = null;
+          var originalGetFocusedWidget = NULL;
           if (CKEDITOR.plugins.drupalimage) {
             originalGetFocusedWidget = CKEDITOR.plugins.drupalimage.getFocusedWidget;
           } else {
@@ -91,7 +91,7 @@
             if (originalGetFocusedWidget) {
               return originalGetFocusedWidget(editor);
             }
-            return null;
+            return NULL;
           };
         }
       }
@@ -101,12 +101,12 @@
         allowedContent: 'drupal-entity[data-embed-button,data-entity-type,data-entity-uuid,data-entity-embed-display,data-entity-embed-display-settings,data-align,data-caption]',
         requiredContent: 'drupal-entity[data-embed-button,data-entity-type,data-entity-uuid,data-entity-embed-display,data-entity-embed-display-settings,data-align,data-caption]',
         modes: { wysiwyg : 1 },
-        canUndo: true,
+        canUndo: TRUE,
         exec: function (editor, data) {
           data = data || {};
 
           var existingElement = getSelectedEmbeddedEntity(editor);
-          var existingWidget = (existingElement) ? editor.widgets.getByElement(existingElement, true) : null;
+          var existingWidget = (existingElement) ? editor.widgets.getByElement(existingElement, TRUE) : NULL;
 
           var existingValues = {};
 
@@ -124,7 +124,7 @@
 
           var dialogSettings = {
             dialogClass: 'entity-select-dialog',
-            resizable: false
+            resizable: FALSE
           };
 
           var saveCallback = function (values) {
@@ -138,10 +138,10 @@
               editor.insertHtml(entityElement.getOuterHtml());
             }
             else {
-              var hasCaption = false;
+              var hasCaption = FALSE;
               if (values.attributes['data-caption']) {
                 values.attributes['data-caption'] = CKEDITOR.tools.htmlDecodeAttr(values.attributes['data-caption']);
-                hasCaption = true;
+                hasCaption = TRUE;
               }
               existingWidget.setData({ attributes: values.attributes, hasCaption: hasCaption });
             }
@@ -176,7 +176,7 @@
           }
           data.attributes = CKEDITOR.tools.copy(attributes);
           data.hasCaption = data.attributes.hasOwnProperty('data-caption');
-          data.link = null;
+          data.link = NULL;
           if (element.parent.name === 'a') {
             data.link = CKEDITOR.tools.copy(element.parent.attributes);
             // Omit CKEditor-internal attributes.
@@ -203,7 +203,7 @@
           }
         },
 
-        destroy: function() {
+        destroy: function () {
           this._tearDownDynamicEditables();
         },
 
@@ -249,7 +249,7 @@
             // @see ckeditor_ckeditor_css_alter()
             captionEditable.setAttribute('data-placeholder', Drupal.t('Enter caption here'));
             // And ensure that any changes made to it are persisted.
-            var config = {characterData: true, attributes: true, childList: true, subtree: true};
+            var config = {characterData: TRUE, attributes: TRUE, childList: TRUE, subtree: TRUE};
             var widget = this;
             this.captionEditableMutationObserver = new MutationObserver(function () {
               var entityAttributes = CKEDITOR.tools.clone(widget.data.attributes);
@@ -269,7 +269,7 @@
         _previewNeedsServersideUpdate: function () {
           // When the widget is first loading, it of course needs to still get a preview!
           if (!this.ready) {
-            return true;
+            return TRUE;
           }
 
           return this._hashData(this.oldData) !== this._hashData(this.data);
@@ -280,10 +280,10 @@
           // The preview's caption must be updated when the caption was edited in EntityEmbedDialog.
           // @see https://www.drupal.org/project/entity_embed/issues/3060397
           if (this.data.hasCaption && this.editables.caption.getData() !== this.data.attributes['data-caption']) {
-            return true;
+            return TRUE;
           }
 
-          return false;
+          return FALSE;
         },
 
         // @todo Remove in https://www.drupal.org/project/entity_embed/issues/3060397
@@ -291,7 +291,7 @@
           if (this.data.hasCaption) {
             this.captionEditableMutationObserver.disconnect();
             this.editables.caption.$.innerHTML = this.data.attributes['data-caption'];
-            var config = {characterData: true, attributes: false, childList: true, subtree: true};
+            var config = {characterData: TRUE, attributes: FALSE, childList: TRUE, subtree: TRUE};
             this.captionEditableMutationObserver.observe(this.editables.caption.$, config);
           }
         },
@@ -326,7 +326,7 @@
             headers: {
               'X-Drupal-EmbedPreview-CSRF-Token': editor.config.DrupalEntity_previewCsrfToken
             },
-          }).done(function(previewHtml) {
+          }).done(function (previewHtml) {
             widget.element.setHtml(previewHtml);
             callback(widget);
           });
@@ -357,7 +357,7 @@
             label: button.label,
             data: button,
             allowedContent: 'drupal-entity[!data-entity-type,!data-entity-uuid,!data-entity-embed-display,!data-entity-embed-display-settings,!data-align,!data-caption,!data-embed-button,!data-langcode,!alt,!title]',
-            click: function(editor) {
+            click: function (editor) {
               editor.execCommand('editdrupalentity', this.data);
             },
             icon: button.image,
@@ -383,7 +383,7 @@
           });
         }
 
-        editor.contextMenu.addListener(function(element) {
+        editor.contextMenu.addListener(function (element) {
           if (isEditableEntityWidget(editor, element)) {
             var button_id = element.getFirst().getAttribute('data-embed-button');
             var returnData = {};
@@ -411,7 +411,7 @@
       return selectedElement;
     }
 
-    return null;
+    return NULL;
   }
 
   /**
@@ -420,16 +420,16 @@
    * @param {CKEDITOR.editor} editor
    * @param {CKEDITOR.htmlParser.element} element
    */
-  function isEditableEntityWidget (editor, element) {
-    var widget = editor.widgets.getByElement(element, true);
+  function isEditableEntityWidget(editor, element) {
+    var widget = editor.widgets.getByElement(element, TRUE);
     if (!widget || widget.name !== 'drupalentity') {
-      return false;
+      return FALSE;
     }
 
     var button = element.$.firstChild.getAttribute('data-embed-button');
     if (!button) {
       // If there was no data-embed-button attribute, not editable.
-      return false;
+      return FALSE;
     }
 
     // The button itself must be valid.
diff --git a/src/EntityEmbedBuilder.php b/src/EntityEmbedBuilder.php
index 892ec3a..1b84375 100644
--- a/src/EntityEmbedBuilder.php
+++ b/src/EntityEmbedBuilder.php
@@ -63,7 +63,7 @@ class EntityEmbedBuilder implements EntityEmbedBuilderInterface {
     // otherwise we'll encounter a fatal error when calling
     // $this->buildEntityEmbedDisplayPlugin() further down the line.
     if (!is_array($context['data-entity-embed-display-settings'])) {
-      \Drupal::logger('entity_embed')->warning('Invalid display settings encountered. Could not process following settings for entity type "@entity_type" with the uuid "@uuid": @settings', [
+      $this->('entity_embed')->warning('Invalid display settings encountered. Could not process following settings for entity type "@entity_type" with the uuid "@uuid": @settings', [
         '@settings' => $context['data-entity-embed-display-settings'],
         '@entity_type' => $entity->getEntityTypeId(),
         '@uuid' => $entity->uuid(),
@@ -83,7 +83,11 @@ class EntityEmbedBuilder implements EntityEmbedBuilderInterface {
     }
 
     // Allow modules to alter the entity prior to embed rendering.
-    $this->moduleHandler->alter(["{$context['data-entity-type']}_embed_context", 'entity_embed_context'], $context, $entity);
+    $this->moduleHandler->alter(
+      [
+        "{$context['data-entity-type']}_embed_context",
+        'entity_embed_context',
+      ], $context, $entity);
 
     // Build and render the Entity Embed Display plugin, allowing modules to
     // alter the result before rendering.
@@ -123,7 +127,11 @@ class EntityEmbedBuilder implements EntityEmbedBuilderInterface {
     $build['#access'] = $entity->access('view', NULL, TRUE);
 
     // @todo Should this hook get invoked if $build is an empty array?
-    $this->moduleHandler->alter(["{$context['data-entity-type']}_embed", 'entity_embed'], $build, $entity, $context);
+    $this->moduleHandler->alter(
+      [
+        "{$context['data-entity-type']}_embed",
+        'entity_embed',
+      ], $build, $entity, $context);
     return $build;
   }
 
diff --git a/src/EntityEmbedDisplay/EntityEmbedDisplayManager.php b/src/EntityEmbedDisplay/EntityEmbedDisplayManager.php
index 67531e2..e33594f 100644
--- a/src/EntityEmbedDisplay/EntityEmbedDisplayManager.php
+++ b/src/EntityEmbedDisplay/EntityEmbedDisplayManager.php
@@ -127,7 +127,11 @@ class EntityEmbedDisplayManager extends DefaultPluginManager {
    *   An array of valid plugin labels, keyed by plugin ID.
    */
   public function getDefinitionOptionsForEntity(EntityInterface $entity) {
-    $definitions = $this->getDefinitionsForContexts(['entity' => $entity, 'entity_type' => $entity->getEntityTypeId()]);
+    $definitions = $this->getDefinitionsForContexts(
+      [
+        'entity' => $entity,
+        'entity_type' => $entity->getEntityTypeId(),
+      ]);
     $definitions = $this->filterExposedDefinitions($definitions);
     return array_map(function ($definition) {
       return (string) $definition['label'];
diff --git a/src/EntityEmbedDisplay/FieldFormatterEntityEmbedDisplayBase.php b/src/EntityEmbedDisplay/FieldFormatterEntityEmbedDisplayBase.php
index 99b6e24..fcce731 100644
--- a/src/EntityEmbedDisplay/FieldFormatterEntityEmbedDisplayBase.php
+++ b/src/EntityEmbedDisplay/FieldFormatterEntityEmbedDisplayBase.php
@@ -3,14 +3,10 @@
 namespace Drupal\entity_embed\EntityEmbedDisplay;
 
 use Drupal\Core\Access\AccessResult;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
-use Drupal\Core\Field\FormatterPluginManager;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\PluginDependencyTrait;
 use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\TypedData\TypedDataManager;
 use Drupal\entity_embed\Entity\EntityEmbedFakeEntity;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -124,7 +120,7 @@ abstract class FieldFormatterEntityEmbedDisplayBase extends EntityEmbedDisplayBa
 
     $definition = $this->getFieldDefinition();
 
-    /* @var \Drupal\Core\Field\FieldItemListInterface $items $items */
+    /** @var \Drupal\Core\Field\FieldItemListInterface $items $items */
     // Create a field item list object, 1 is the value, array('target_id' => 1)
     // would work too, or multiple values. 1 is passed down from the list to the
     // field item, which knows that an integer is the ID.
@@ -225,6 +221,7 @@ abstract class FieldFormatterEntityEmbedDisplayBase extends EntityEmbedDisplayBa
    * constructor are called.
    *
    * @return \Drupal\Core\Field\FormatterPluginManager
+   *   A new field definition.
    */
   public function formatterPluginManager() {
     if (!isset($this->formatterPluginManager)) {
diff --git a/src/Form/EntityEmbedDialog.php b/src/Form/EntityEmbedDialog.php
index 5ae3b11..41415e9 100644
--- a/src/Form/EntityEmbedDialog.php
+++ b/src/Form/EntityEmbedDialog.php
@@ -181,14 +181,14 @@ class EntityEmbedDialog extends FormBase {
     // The default values are set directly from \Drupal::request()->request,
     // provided by the editor plugin opening the dialog.
     if (!$form_state->get('entity_element')) {
-      $form_state->set('entity_element', isset($input['editor_object']) ? $input['editor_object'] : []);
+      $form_state->set('entity_element', $input['editor_object'] ?? []);
     }
     $entity_element += $form_state->get('entity_element');
     $entity_element += [
       'data-entity-type' => $embed_button->getTypeSetting('entity_type'),
       'data-entity-uuid' => '',
       'data-entity-embed-display' => 'entity_reference:entity_reference_entity_view',
-      'data-entity-embed-display-settings' => isset($form_state->get('entity_element')['data-entity-embed-settings']) ? $form_state->get('entity_element')['data-entity-embed-settings'] : [],
+      'data-entity-embed-display-settings' => $form_state->get('entity_element')['data-entity-embed-settings'] ?? [],
     ];
     $form_state->set('entity_element', $entity_element);
     $entity = $this->loadEntityByAttributes($entity_element);
@@ -264,7 +264,11 @@ class EntityEmbedDialog extends FormBase {
     $form['#title'] = $this->t('Select @type to embed', ['@type' => $entity_type->getSingularLabel()]);
 
     if ($this->entityBrowser) {
-      $this->eventDispatcher->addListener(Events::REGISTER_JS_CALLBACKS, [$this, 'registerJSCallback']);
+      $this->eventDispatcher->addListener(Events::REGISTER_JS_CALLBACKS,
+        [
+          $this,
+          'registerJSCallback',
+        ]);
       $form['entity_browser'] = [
         '#type' => 'entity_browser',
         '#entity_browser' => $this->entityBrowser->id(),
@@ -511,7 +515,7 @@ class EntityEmbedDialog extends FormBase {
           'center' => $this->t('Center'),
           'right' => $this->t('Right'),
         ],
-        '#default_value' => isset($entity_element['data-align']) ? $entity_element['data-align'] : '',
+        '#default_value' => $entity_element['data-align'] ?? '',
         '#wrapper_attributes' => ['class' => ['container-inline']],
         '#attributes' => ['class' => ['container-inline']],
       ];
@@ -599,14 +603,26 @@ class EntityEmbedDialog extends FormBase {
     }
     if ($entity = $this->entityTypeManager->getStorage($entity_type)->load($id)) {
       if (!$entity->access('view')) {
-        $form_state->setError($element, $this->t('Unable to access @type entity @id.', ['@type' => $entity_type, '@id' => $id]));
+        $form_state->setError($element,
+          $this->t('Unable to access @type
+            entity @id.',
+            [
+              '@type' => $entity_type,
+              '@id' => $id,
+            ]));
       }
       else {
         if ($uuid = $entity->uuid()) {
           $form_state->setValueForElement($form['attributes']['data-entity-uuid'], $uuid);
         }
         else {
-          $form_state->setError($element, $this->t('Cannot embed @type entity @id because it does not have a UUID.', ['@type' => $entity_type, '@id' => $id]));
+          $form_state->setError($element,
+            $this->t('Cannot embed @type entity
+              @id because it does not have a UUID.',
+              [
+                '@type' => $entity_type,
+                '@id' => $id,
+              ]));
         }
 
         // Ensure that at least one Entity Embed Display plugin is present
@@ -626,7 +642,13 @@ class EntityEmbedDialog extends FormBase {
       }
     }
     else {
-      $form_state->setError($element, $this->t('Unable to load @type entity @id.', ['@type' => $entity_type, '@id' => $id]));
+      $form_state->setError($element,
+        $this->t('Unable to load @type entity
+          @id.',
+          [
+            '@type' => $entity_type,
+            '@id' => $id,
+          ]));
     }
   }
 
@@ -877,7 +899,7 @@ class EntityEmbedDialog extends FormBase {
    * Callbacks are responsible for getting entities from entity browser and
    * updating form values accordingly.
    */
-  public function registerJSCallback(RegisterJSCallbacks $event) {
+  public function registerJsCallback(RegisterJSCallbacks $event) {
     if ($event->getBrowserID() == $this->entityBrowser->id()) {
       $event->registerCallback('Drupal.entityEmbedDialog.selectionCompleted');
     }
diff --git a/src/Plugin/CKEditorPlugin/DrupalEntity.php b/src/Plugin/CKEditorPlugin/DrupalEntity.php
index 39b8028..fbdc30c 100644
--- a/src/Plugin/CKEditorPlugin/DrupalEntity.php
+++ b/src/Plugin/CKEditorPlugin/DrupalEntity.php
@@ -39,8 +39,8 @@ class DrupalEntity extends EmbedCKEditorPluginBase implements CKEditorPluginCssI
    */
   public function getConfig(Editor $editor) {
     return [
-      'DrupalEntity_dialogTitleAdd' => t('Insert entity'),
-      'DrupalEntity_dialogTitleEdit' => t('Edit entity'),
+      'DrupalEntity_dialogTitleAdd' => $this->t('Insert entity'),
+      'DrupalEntity_dialogTitleEdit' => $this->t('Edit entity'),
       'DrupalEntity_buttons' => $this->getButtons(),
       'DrupalEntity_previewCsrfToken' => \Drupal::csrfToken()->get('X-Drupal-EmbedPreview-CSRF-Token'),
     ];
diff --git a/src/Plugin/EmbedType/Entity.php b/src/Plugin/EmbedType/Entity.php
index 554ff3d..9f69b7d 100644
--- a/src/Plugin/EmbedType/Entity.php
+++ b/src/Plugin/EmbedType/Entity.php
@@ -161,7 +161,11 @@ class Entity extends EmbedTypeBase implements ContainerFactoryPluginInterface {
           },
           // Filter out both modal and standalone forms as they don't work.
           array_filter($browsers, function (EntityBrowserInterface $browser) {
-            return !in_array($browser->getDisplay()->getPluginId(), ['modal', 'standalone'], TRUE);
+            return !in_array($browser->getDisplay()->getPluginId(),
+              [
+                'modal',
+                'standalone',
+              ], TRUE);
           })
         );
         $options = ['_none' => $this->t('None (autocomplete)')] + $browsers;
diff --git a/src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php b/src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php
index 9e79f7d..951aab0 100644
--- a/src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php
+++ b/src/Plugin/entity_embed/EntityEmbedDisplay/EntityReferenceFieldFormatter.php
@@ -3,13 +3,8 @@
 namespace Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay;
 
 use Drupal\Core\Access\AccessResult;
-use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Entity\ContentEntityInterface;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Field\FormatterPluginManager;
-use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Security\TrustedCallbackInterface;
-use Drupal\Core\TypedData\TypedDataManager;
 use Drupal\entity_embed\EntityEmbedDisplay\FieldFormatterEntityEmbedDisplayBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
diff --git a/src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php b/src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php
index fd23923..59827fd 100644
--- a/src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php
+++ b/src/Plugin/entity_embed/EntityEmbedDisplay/ImageFieldFormatter.php
@@ -3,14 +3,8 @@
 namespace Drupal\entity_embed\Plugin\entity_embed\EntityEmbedDisplay;
 
 use Drupal\Core\Access\AccessResult;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Field\FormatterPluginManager;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Image\ImageFactory;
-use Drupal\Core\Language\LanguageManagerInterface;
-use Drupal\Core\Messenger\MessengerInterface;
 use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\TypedData\TypedDataManager;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -60,7 +54,12 @@ class ImageFieldFormatter extends FileFieldFormatter {
     $value = parent::getFieldValue();
     // File field support descriptions, but images do not.
     unset($value['description']);
-    $value += array_intersect_key($this->getAttributeValues(), ['alt' => '', 'title' => '']);
+    $value += array_intersect_key(
+      $this->getAttributeValues(),
+      [
+        'alt' => '',
+        'title' => '',
+      ]);
     return $value;
   }
 
@@ -93,7 +92,7 @@ class ImageFieldFormatter extends FileFieldFormatter {
     if ($entity = $this->getEntityFromContext()) {
       // Loading large files is slow, make sure it is an image mime type before
       // doing that.
-      list($type,) = explode('/', $entity->getMimeType(), 2);
+      [$type] = explode('/', $entity->getMimeType(), 2);
       $is_valid_image = FALSE;
       if ($type == 'image') {
         $is_valid_image = $this->imageFactory->get($entity->getFileUri())->isValid();
@@ -162,7 +161,7 @@ class ImageFieldFormatter extends FileFieldFormatter {
       '#type' => 'textfield',
       '#title' => $this->t('Title'),
       '#default_value' => $this->getAttributeValue('title', ''),
-      '#description' => t('The title is used as a tool tip when the user hovers the mouse over the image.'),
+      '#description' => $this->t('The title is used as a tool tip when the user hovers the mouse over the image.'),
       '#parents' => ['attributes', 'title'],
       '#maxlength' => 1024,
     ];
diff --git a/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImageDecorator.php b/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImageDecorator.php
index 7d319eb..575c685 100644
--- a/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImageDecorator.php
+++ b/src/Plugin/entity_embed/EntityEmbedDisplay/MediaImageDecorator.php
@@ -118,8 +118,8 @@ class MediaImageDecorator implements EntityEmbedDisplayInterface {
       $settings = $entity->{$image_field}->getItemDefinition()->getSettings();
       $attributes = $this->getAttributeValues();
 
-      $alt = isset($attributes['alt']) ? $attributes['alt'] : NULL;
-      $title = isset($attributes['title']) ? $attributes['title'] : NULL;
+      $alt = $attributes['alt'] ?? NULL;
+      $title = $attributes['title'] ?? NULL;
 
       // Setting empty alt to double quotes. See ImageFieldFormatter.
       if ($settings['alt_field_required'] && $alt === '') {
@@ -144,7 +144,7 @@ class MediaImageDecorator implements EntityEmbedDisplayInterface {
           '#type' => 'textfield',
           '#title' => $this->t('Title'),
           '#default_value' => $title,
-          '#description' => t('The title is used as a tool tip when the user hovers the mouse over the image.'),
+          '#description' => $this->t('The title is used as a tool tip when the user hovers the mouse over the image.'),
           '#maxlength' => 1024,
           '#placeholder' => $entity->{$image_field}->title,
         ];
@@ -162,7 +162,11 @@ class MediaImageDecorator implements EntityEmbedDisplayInterface {
     $entity = $this->decorated->getEntityFromContext();
     if ($image_field = $this->getMediaImageSourceField($entity)) {
       $settings = $entity->{$image_field}->getItemDefinition()->getSettings();
-      $values = $form_state->getValue(['attributes', 'data-entity-embed-display-settings']);
+      $values = $form_state->getValue(
+        [
+          'attributes',
+          'data-entity-embed-display-settings',
+        ]);
 
       if (!empty($settings['alt_field'])) {
         // When the alt attribute is set to two double quotes, transform it to
diff --git a/tests/fixtures/update/entity_embed.update-hook-test.php b/tests/fixtures/update/entity_embed.update-hook-test.php
index 860975c..7da9b24 100644
--- a/tests/fixtures/update/entity_embed.update-hook-test.php
+++ b/tests/fixtures/update/entity_embed.update-hook-test.php
@@ -42,7 +42,7 @@ $extensions = $connection->select('config')
   ->condition('name', 'core.extension')
   ->execute()
   ->fetchField();
-$extensions = unserialize($extensions);
+$extensions = unserialize($extensions, ['allowed_classes' => FALSE]);
 $extensions['module']['embed'] = 8000;
 $extensions['module']['entity_embed'] = 8001;
 $extensions['module']['embed'] = 8000;
diff --git a/tests/modules/entity_embed_test/entity_embed_test.routing.yml b/tests/modules/entity_embed_test/entity_embed_test.routing.yml
index 9c87ed4..28d1011 100644
--- a/tests/modules/entity_embed_test/entity_embed_test.routing.yml
+++ b/tests/modules/entity_embed_test/entity_embed_test.routing.yml
@@ -3,18 +3,18 @@ entity_embed_test.entity_embed_twig_test.id:
   defaults:
     _controller: '\Drupal\entity_embed_test\EntityEmbedTestTwigController::idRender'
   requirements:
-    _access: 'TRUE'
+    # Needs to be accessed by an anonymous user.
 
 entity_embed_test.entity_embed_twig_test.label_plugin:
   path: '/entity_embed_twig_test/label_plugin'
   defaults:
     _controller: '\Drupal\entity_embed_test\EntityEmbedTestTwigController::labelPluginRender'
   requirements:
-    _access: 'TRUE'
+    # Needs to be accessed by an anonymous user.
 
 entity_embed_test.entity_embed_twig_test.label_plugin_no_link:
   path: '/entity_embed_twig_test/label_plugin_no_link'
   defaults:
     _controller: '\Drupal\entity_embed_test\EntityEmbedTestTwigController::labelPluginNoLinkRender'
   requirements:
-    _access: 'TRUE'
+    # Needs to be accessed by an anonymous user.
diff --git a/tests/src/Functional/EntityEmbedTestBase.php b/tests/src/Functional/EntityEmbedTestBase.php
index 5bebea6..3393dd5 100644
--- a/tests/src/Functional/EntityEmbedTestBase.php
+++ b/tests/src/Functional/EntityEmbedTestBase.php
@@ -106,7 +106,11 @@ abstract class EntityEmbedTestBase extends BrowserTestBase {
     $settings = [];
     $settings['type'] = 'page';
     $settings['title'] = 'Embed Test Node';
-    $settings['body'] = ['value' => 'This node is to be used for embedding in other nodes.', 'format' => 'custom_format'];
+    $settings['body'] =
+    [
+      'value' => 'This node is to be used for embedding in other nodes.',
+      'format' => 'custom_format',
+    ];
     $this->node = $this->drupalCreateNode($settings);
   }
 
diff --git a/tests/src/Functional/ViewModeFieldFormatterTest.php b/tests/src/Functional/ViewModeFieldFormatterTest.php
index 7207914..8f90255 100644
--- a/tests/src/Functional/ViewModeFieldFormatterTest.php
+++ b/tests/src/Functional/ViewModeFieldFormatterTest.php
@@ -16,6 +16,11 @@ class ViewModeFieldFormatterTest extends EntityEmbedTestBase {
    */
   protected $defaultTheme = 'classy';
 
+  /**
+   * Default plugins list.
+   *
+   * @var plugins
+   */
   private $plugins = [
     'view_mode:node.full',
     'view_mode:node.rss',
diff --git a/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
index b3d1804..c7a4db7 100644
--- a/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
+++ b/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
@@ -219,7 +219,11 @@ class CKEditorIntegrationTest extends EntityEmbedTestBase {
       ->setValue('Pirates');
     // Verify that undo/redo work.
     $this->assertCkeditorUndoOrRedo('undo', ['Goodbye world!'], ['Billy Bones']);
-    $this->assertCkeditorUndoOrRedo('undo', [], ['Billy Bones', 'Goodbye world!']);
+    $this->assertCkeditorUndoOrRedo('undo', [],
+      [
+        'Billy Bones',
+        'Goodbye world!',
+      ]);
     $this->assertCkeditorUndoOrRedo('redo', ['Goodbye world!'], ['Billy Bones']);
     $this->assertCkeditorUndoOrRedo('redo', ['Billy Bones', 'Goodbye world!'], []);
     // Verify that the embedded entity is rendered by the filter for end users.
diff --git a/tests/src/FunctionalJavascript/ConfigurationUiTest.php b/tests/src/FunctionalJavascript/ConfigurationUiTest.php
index 7abdf03..0abb74c 100644
--- a/tests/src/FunctionalJavascript/ConfigurationUiTest.php
+++ b/tests/src/FunctionalJavascript/ConfigurationUiTest.php
@@ -203,8 +203,7 @@ class ConfigurationUiTest extends EntityEmbedTestBase {
   }
 
   /**
-   * Data provider for testValidationWhenAdding() and
-   * testValidationWhenEditing().
+   * Data provider for testValidationWhenAdding().
    */
   public function providerTestValidations() {
     return [
diff --git a/tests/src/FunctionalJavascript/SortableTestTrait.php b/tests/src/FunctionalJavascript/SortableTestTrait.php
index 3d1891a..f5bc3e7 100644
--- a/tests/src/FunctionalJavascript/SortableTestTrait.php
+++ b/tests/src/FunctionalJavascript/SortableTestTrait.php
@@ -118,6 +118,9 @@ JS;
     $this->sortableUpdate($item, $from);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   protected function doLegacyDrag($item, $target) {
     $assert_session = $this->assertSession();
     $target = $assert_session->elementExists('css', $target);
diff --git a/tests/src/Kernel/EntityEmbedFilterTest.php b/tests/src/Kernel/EntityEmbedFilterTest.php
index 854e354..279d3fa 100644
--- a/tests/src/Kernel/EntityEmbedFilterTest.php
+++ b/tests/src/Kernel/EntityEmbedFilterTest.php
@@ -56,12 +56,18 @@ class EntityEmbedFilterTest extends EntityEmbedFilterTestBase {
     $this->assertSame(['entity_embed/caption'], $result->getAttachments()['library']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   private function getCacheTags(FilterProcessResult $result): array {
     $cache_tags = $result->getCacheTags();
     sort($cache_tags);
     return $cache_tags;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   private function getCacheContexts(FilterProcessResult $result): array {
     $cache_contexts = $result->getCacheContexts();
     sort($cache_contexts);
diff --git a/tests/src/Kernel/EntityEmbedFilterTestBase.php b/tests/src/Kernel/EntityEmbedFilterTestBase.php
index 43e287f..6dc036a 100644
--- a/tests/src/Kernel/EntityEmbedFilterTestBase.php
+++ b/tests/src/Kernel/EntityEmbedFilterTestBase.php
@@ -71,7 +71,7 @@ abstract class EntityEmbedFilterTestBase extends KernelTestBase {
 
     // Create a user with required permissions. Ensure that we don't use user 1
     // because that user is treated in special ways by access control handlers.
-    $admin_user = $this->drupalCreateUser([]);
+    $this->drupalCreateUser([]);
     $user = $this->drupalCreateUser([
       'access content',
     ]);
