diff --git a/default_paragraphs.module b/default_paragraphs.module
index e764592..f5f7899 100644
--- a/default_paragraphs.module
+++ b/default_paragraphs.module
@@ -1,17 +1,18 @@
 <?php
+
 /**
  * @file
  * Module file for Default Paragraphs module.
  */
 
-use \Drupal\Core\Routing\RouteMatchInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
 
 /**
  * Implements hook_help().
  */
 function default_paragraphs_help($route_name, RouteMatchInterface $route_match) {
   switch ($route_name) {
-    case 'help.page.default_paragraphs' :
+    case 'help.page.default_paragraphs':
       $text = file_get_contents(dirname(__FILE__) . '/README.md');
       if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
         return '<pre>' . $text . '</pre>';
diff --git a/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php b/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
index cb7d292..0ac9c2c 100644
--- a/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
+++ b/src/Plugin/Field/FieldWidget/DefaultParagraphsWidget.php
@@ -19,6 +19,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
 use Drupal\Core\Utility\Token;
 
+// Use \Drupal\Core\StringTranslation\StringTranslationTrait;.
 /**
  * Plugin implementation of the 'entity_reference_revisions paragraphs' widget.
  *
@@ -71,7 +72,7 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
    *   Event dispatcher service.
    * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
    *   The entity display repository.
-   * @param \Drupal\Core\Utility\Token $token_service.
+   * @param \Drupal\Core\Utility\Token $token_service
    *   Token service.
    */
   public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EventDispatcherInterface $event_dispatcher, EntityDisplayRepositoryInterface $entity_display_repository, Token $token_service) {
@@ -203,8 +204,8 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
         ],
       ],
       '#element_validate' => [
-        [$this,  'settingsFormDefaultParagraphsValidate']
-      ]
+        [$this, 'settingsFormDefaultParagraphsValidate'],
+      ],
     ];
 
     // We iterate over the allowed paragraph types, if nothing is selected yet.
@@ -242,7 +243,7 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
           ],
           'value' => [
             '#type' => 'checkbox',
-            '#default_value' => isset($defaults[$key]['value']) ? $defaults[$key]['value'] : 0,
+            '#default_value' => $defaults[$key]['value'] ?? 0,
           ],
           'edit_mode' => [
             '#type' => 'select',
@@ -250,7 +251,7 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
               'edit' => $this->t('Open'),
               'closed' => $this->t('Closed'),
             ],
-            '#default_value' => isset($defaults[$key]['edit_mode']) ? $defaults[$key]['edit_mode'] : 'closed',
+            '#default_value' => $defaults[$key]['edit_mode'] ?? 'closed',
           ],
           'weight' => [
             '#type' => 'weight',
@@ -265,7 +266,7 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
         ];
 
         $elements['default_paragraph_types'][$key]['#attributes']['class'][] = 'draggable';
-        $elements['default_paragraph_types'][$key]['#weight'] = isset($defaults[$key]['weight']) ? $defaults[$key]['weight'] : 1000;
+        $elements['default_paragraph_types'][$key]['#weight'] = $defaults[$key]['weight'] ?? 1000;
       }
     }
 
@@ -283,16 +284,16 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
 
       if ($cardinality !== -1) {
         $default_paragraph_count = 0;
-        foreach ($element['#value'] as $key => $data) {
+        foreach ($element['#value'] as $data) {
           if (!empty($data['value'])) {
             $default_paragraph_count++;
           }
         }
 
         if ($default_paragraph_count > $cardinality) {
-          $form_state->setErrorByName('default_paragraph_types', t('@field field allows you to select not more than @total paragraph types as default.', [
+          $form_state->setErrorByName('default_paragraph_types', $this->t('@field field allows you to select not more than @total paragraph types as default.', [
             '@field' => $field_label,
-            '@total' => $cardinality
+            '@total' => $cardinality,
           ]));
         }
       }
@@ -358,7 +359,7 @@ class DefaultParagraphsWidget extends ParagraphsWidget implements ContainerFacto
         $field_state['paragraphs'][$delta] = [
           'entity' => $paragraphs_entity,
           'display' => $display,
-          'mode' => isset($default_type['edit_mode']) ? $default_type['edit_mode'] : 'closed',
+          'mode' => $default_type['edit_mode'] ?? 'closed',
           'original_delta' => 1,
         ];
         $max++;
