From f85a909890d482876a4663555d77d8f0b4cb95eb Mon Sep 17 00:00:00 2001
From: Liam Morland <liam@openplus.ca>
Date: Wed, 23 Nov 2022 08:24:38 -0500
Subject: [PATCH] Issue #3139382: Use ::class to refer to class names

---
 src/Form/FillPdfSettingsForm.php          | 5 +++--
 src/Plugin/FillPdfActionPluginManager.php | 3 ++-
 src/Plugin/PdfBackendManager.php          | 3 ++-
 src/Serializer.php                        | 6 ++++--
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/Form/FillPdfSettingsForm.php b/src/Form/FillPdfSettingsForm.php
index 5ee6a12..8dcf656 100644
--- a/src/Form/FillPdfSettingsForm.php
+++ b/src/Form/FillPdfSettingsForm.php
@@ -8,6 +8,7 @@ use Drupal\Core\File\FileSystemInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Link;
+use Drupal\Core\Render\Element\Select;
 use Drupal\Core\Render\RendererInterface;
 use Drupal\fillpdf\Component\Utility\FillPdf;
 use Drupal\fillpdf\Entity\FillPdfForm;
@@ -332,11 +333,11 @@ class FillPdfSettingsForm extends ConfigFormBase {
       // Remove once one of these landed.
       // @see https://www.drupal.org/project/drupal/issues/2854166
       $form['shell_locale']['#process'][] = [
-        'Drupal\Core\Render\Element\Select',
+        Select::class,
         'processGroup',
       ];
       $form['shell_locale']['#pre_render'][] = [
-        'Drupal\Core\Render\Element\Select',
+        Select::class,
         'preRenderGroup',
       ];
     }
diff --git a/src/Plugin/FillPdfActionPluginManager.php b/src/Plugin/FillPdfActionPluginManager.php
index c27deee..6456202 100644
--- a/src/Plugin/FillPdfActionPluginManager.php
+++ b/src/Plugin/FillPdfActionPluginManager.php
@@ -5,6 +5,7 @@ namespace Drupal\fillpdf\Plugin;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\fillpdf\Annotation\FillPdfActionPlugin;
 
 /**
  * Provides the FillPDF action plugin plugin manager.
@@ -23,7 +24,7 @@ class FillPdfActionPluginManager extends DefaultPluginManager {
    *   The module handler to invoke the alter hook with.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/FillPdfActionPlugin', $namespaces, $module_handler, 'Drupal\fillpdf\Plugin\FillPdfActionPluginInterface', 'Drupal\fillpdf\Annotation\FillPdfActionPlugin');
+    parent::__construct('Plugin/FillPdfActionPlugin', $namespaces, $module_handler, FillPdfActionPluginInterface::class, FillPdfActionPlugin::class);
 
     $this->alterInfo('fillpdf_fillpdf_action_info');
     $this->setCacheBackend($cache_backend, 'fillpdf_fillpdf_action_plugins');
diff --git a/src/Plugin/PdfBackendManager.php b/src/Plugin/PdfBackendManager.php
index ac369d0..368087b 100644
--- a/src/Plugin/PdfBackendManager.php
+++ b/src/Plugin/PdfBackendManager.php
@@ -6,6 +6,7 @@ use Drupal\Component\Plugin\FallbackPluginManagerInterface;
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\fillpdf\Annotation\PdfBackend;
 
 /**
  * Provides the FillPDF PdfBackend plugin manager.
@@ -24,7 +25,7 @@ class PdfBackendManager extends DefaultPluginManager implements FallbackPluginMa
    *   The module handler to invoke the alter hook with.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
-    parent::__construct('Plugin/PdfBackend', $namespaces, $module_handler, 'Drupal\fillpdf\Plugin\PdfBackendInterface', 'Drupal\fillpdf\Annotation\PdfBackend');
+    parent::__construct('Plugin/PdfBackend', $namespaces, $module_handler, PdfBackendInterface::class, PdfBackend::class);
 
     $this->alterInfo('fillpdf_pdfbackend_info');
     $this->setCacheBackend($cache_backend, 'fillpdf_pdfbackend_plugins');
diff --git a/src/Serializer.php b/src/Serializer.php
index 2391077..97f6975 100644
--- a/src/Serializer.php
+++ b/src/Serializer.php
@@ -3,6 +3,8 @@
 namespace Drupal\fillpdf;
 
 use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\fillpdf\Entity\FillPdfForm;
+use Drupal\fillpdf\Entity\FillPdfFormField;
 use Symfony\Component\Serializer\Serializer as SymfonySerializer;
 
 /**
@@ -59,7 +61,7 @@ class Serializer implements SerializerInterface {
    */
   public function deserializeForm($code) {
     $mappings_raw = json_decode($code, TRUE);
-    $decoded_fillpdf_form = $this->serializer->denormalize($mappings_raw['form'], 'Drupal\fillpdf\Entity\FillPdfForm');
+    $decoded_fillpdf_form = $this->serializer->denormalize($mappings_raw['form'], FillPdfForm::class);
 
     // Denormalization is a pain; we have to iterate over the fields to actually
     // recompose the $fields array.
@@ -67,7 +69,7 @@ class Serializer implements SerializerInterface {
     $decoded_fields = [];
 
     foreach ($field_json as $normalized_field) {
-      $field = $this->serializer->denormalize($normalized_field, 'Drupal\fillpdf\Entity\FillPdfFormField');
+      $field = $this->serializer->denormalize($normalized_field, FillPdfFormField::class);
       // @todo Exported fields are now already keyed by PDF key. For now, we're
       // not using the array keys to remain compatible with previous exports,
       // but should do so that at some later point.
-- 
GitLab