diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d9d2f219f8c6e00c00f7d3343730c4d5f9c8362d..619f67fd18ff4c21ae8a4c8ab34822f65204ac31 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,3 +5,11 @@ include:
       - '/includes/include.drupalci.main.yml'
       - '/includes/include.drupalci.variables.yml'
       - '/includes/include.drupalci.workflows.yml'
+
+# Do not allow linting failures.
+phpcs:
+  allow_failure: false
+
+# Do not allow stan failures.
+phpstan:
+  allow_failure: false
diff --git a/composer.json b/composer.json
index e7969faf39cd8771d58337ca60842ab7f447326c..605526589a675fcbf967e1ccfb25d65e17e28541 100644
--- a/composer.json
+++ b/composer.json
@@ -41,8 +41,9 @@
     },
     "minimum-stability": "dev",
     "require":{
+        "php": "^8.1",
         "mkalkbrenner/php-htmldiff-advanced": "~0.0.8",
-        "drupal/core": "^9.3 || ^10"
+        "drupal/core": "^10"
     },
     "require-dev": {
         "jangregor/phpstan-prophecy": "dev-master",
diff --git a/diff.api.php b/diff.api.php
index f4c0d678b8f3d9dcd422ba7ef8344d97b2348a9a..193537c72e0ef9c26e817830d2e8f9f14ec0a567 100644
--- a/diff.api.php
+++ b/diff.api.php
@@ -36,7 +36,7 @@
  *   The array of field diff builders plugins, keyed on the machine-readable
  *    plugin name.
  */
-function hook_field_diff_builder_info_alter(array &$diff_builders) {
+function hook_field_diff_builder_info_alter(array &$diff_builders): void {
   // Set a new label for the text_field_diff_builder plugin
   // instead of the one provided in the annotation.
   $diff_builders['text_field_diff_builder']['label'] = t('New label');
@@ -49,7 +49,7 @@ function hook_field_diff_builder_info_alter(array &$diff_builders) {
  *   The array of diff layout builders plugins, keyed on the machine-readable
  *    plugin name.
  */
-function hook_diff_layout_builder_info_alter(array &$diff_layouts) {
+function hook_diff_layout_builder_info_alter(array &$diff_layouts): void {
   // Set a new label for the text_field_diff_builder plugin
   // instead of the one provided in the annotation.
   $diff_layouts['my_layout']['label'] = t('New label');
diff --git a/diff.info.yml b/diff.info.yml
index 0cb7bfad7a1c72eed8e73a9c71c32a225a0f18b4..1a1452cea6322626913fb2d68367e07b613a9210 100644
--- a/diff.info.yml
+++ b/diff.info.yml
@@ -1,5 +1,5 @@
 name: Diff
 type: module
 description: Shows changes between content revisions.
-core_version_requirement: ^9.3 || ^10
+core_version_requirement: ^10.1
 configure: diff.general_settings
diff --git a/diff.install b/diff.install
index 57901d481633d40ea0f6078d4025a71096758046..b8ce4598519671050df8f8657ffef3a467946c80 100644
--- a/diff.install
+++ b/diff.install
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 /**
  * @file
  * Installation hooks for diff module.
diff --git a/phpcs.xml b/phpcs.xml
index e283efbc5e3a430b552aed2c74b3f2a76702af49..b6bb2b936ea40600c521162e8982afb134a1a4e2 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -5,10 +5,10 @@
   <file>diff.module</file>
   <file>diff.views.inc</file>
   <rule ref="PreviousNextDrupal" />
-
-  <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
-    <severity>0</severity>
+  <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
+    <properties>
+      <property name="spacesCountAroundEqualsSign" value="0" />
+    </properties>
   </rule>
-
   <arg name="report" value="full"/>
 </ruleset>
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index d18133764d7ec1aa574d274c66e7fa76149b239e..ae16e9f5cb57a2b938625053b32b7e5895a6d4d5 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -69,21 +69,11 @@ parameters:
 			count: 1
 			path: src/Controller/PluginRevisionController.php
 
-		-
-			message: "#^Property Drupal\\\\diff\\\\Controller\\\\PluginRevisionController\\:\\:\\$config \\(Drupal\\\\Core\\\\Config\\\\ImmutableConfig\\) does not accept Drupal\\\\Core\\\\Config\\\\Config\\.$#"
-			count: 1
-			path: src/Controller/PluginRevisionController.php
-
 		-
 			message: "#^Right side of && is always true\\.$#"
 			count: 1
 			path: src/Controller/PluginRevisionController.php
 
-		-
-			message: "#^Unsafe usage of new static\\(\\)\\.$#"
-			count: 1
-			path: src/Controller/PluginRevisionController.php
-
 		-
 			message: "#^Call to an undefined method Drupal\\\\Core\\\\Field\\\\FieldStorageDefinitionInterface\\:\\:getDisplayOptions\\(\\)\\.$#"
 			count: 1
@@ -109,21 +99,11 @@ parameters:
 			count: 1
 			path: src/DiffBuilderManager.php
 
-		-
-			message: "#^Property Drupal\\\\diff\\\\DiffBuilderManager\\:\\:\\$pluginDefinitions \\(array\\) in isset\\(\\) is not nullable\\.$#"
-			count: 1
-			path: src/DiffBuilderManager.php
-
 		-
 			message: "#^Access to an undefined property Drupal\\\\Core\\\\Entity\\\\ContentEntityInterface\\:\\:\\$moderation_state\\.$#"
 			count: 1
 			path: src/DiffEntityComparison.php
 
-		-
-			message: "#^Left side of && is always true\\.$#"
-			count: 1
-			path: src/DiffEntityComparison.php
-
 		-
 			message: "#^Method Drupal\\\\diff\\\\DiffEntityComparison\\:\\:getRows\\(\\) should return array but returns string\\.$#"
 			count: 1
@@ -139,11 +119,6 @@ parameters:
 			count: 1
 			path: src/DiffEntityComparison.php
 
-		-
-			message: "#^Only booleans are allowed in &&, Drupal\\\\content_moderation\\\\ModerationInformationInterface given on the left side\\.$#"
-			count: 1
-			path: src/DiffEntityComparison.php
-
 		-
 			message: "#^Only booleans are allowed in &&, Drupal\\\\diff\\\\FieldDiffBuilderInterface\\|null given on the left side\\.$#"
 			count: 1
@@ -214,11 +189,6 @@ parameters:
 			count: 1
 			path: src/DiffLayoutBase.php
 
-		-
-			message: "#^Method Drupal\\\\diff\\\\DiffLayoutBase\\:\\:buildRevisionLink\\(\\) should return Drupal\\\\Core\\\\Link but returns Drupal\\\\Core\\\\GeneratedLink\\.$#"
-			count: 1
-			path: src/DiffLayoutBase.php
-
 		-
 			message: "#^Method Drupal\\\\diff\\\\DiffLayoutBase\\:\\:getConfiguration\\(\\) should return array but returns Drupal\\\\Core\\\\Config\\\\Config\\.$#"
 			count: 1
@@ -763,11 +733,6 @@ parameters:
 			count: 1
 			path: tests/src/Functional/DiffPluginTestBase.php
 
-		-
-			message: "#^Access to an undefined property Drupal\\\\node\\\\NodeInterface\\:\\:\\$field_timestamp\\.$#"
-			count: 1
-			path: tests/src/Functional/DiffPluginVariousTest.php
-
 		-
 			message: "#^Implicit array creation is not allowed \\- variable \\$settings does not exist\\.$#"
 			count: 1
diff --git a/phpstan.neon b/phpstan.neon
index ac6f3c5d79d084dd9ad35921f2393f0ba7f6d40a..6802f243816bb2fee49112df1a99758edc320ebf 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -2,12 +2,12 @@ includes:
   - phpstan-baseline.neon
 parameters:
   level: 6
+  reportUnmatchedIgnoredErrors: true
+  treatPhpDocTypesAsCertain: false
   paths:
     - .
-  reportUnmatchedIgnoredErrors: true
-  checkMissingIterableValueType: false
   strictRules:
-     strictCalls: false
+    strictCalls: false
   fileExtensions:
     - php
     - module
@@ -15,6 +15,9 @@ parameters:
     - profile
     - install
     - inc
+  ignoreErrors:
+    -
+      identifier: missingType.iterableValue
   excludePaths:
     # We cant improve this directory as its contains Drupal-generic code.
     - vendor
diff --git a/src/Annotation/DiffLayoutBuilder.php b/src/Annotation/DiffLayoutBuilder.php
index f13ae125029c592ae81496d8c70f3d0767f97534..73c9e34fd51638aeb910cbea8686934586e2781d 100644
--- a/src/Annotation/DiffLayoutBuilder.php
+++ b/src/Annotation/DiffLayoutBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Annotation;
 
 use Drupal\Component\Annotation\Plugin;
diff --git a/src/Annotation/FieldDiffBuilder.php b/src/Annotation/FieldDiffBuilder.php
index b7b5ad5e4f73df818e46844c50862f88920186d5..c2eeffabdd5aabc2c1a50fc936ad8702aa91449b 100644
--- a/src/Annotation/FieldDiffBuilder.php
+++ b/src/Annotation/FieldDiffBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Annotation;
 
 use Drupal\Component\Annotation\Plugin;
diff --git a/src/Controller/NodeRevisionController.php b/src/Controller/NodeRevisionController.php
index aed231c880f8bf4fbe45c5897cd69abbc5b6f4ce..2602eac7c3e7a3e9e3d2873d1f71321a2dbad739 100644
--- a/src/Controller/NodeRevisionController.php
+++ b/src/Controller/NodeRevisionController.php
@@ -1,7 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Controller;
 
+use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\diff\Form\RevisionOverviewForm;
 use Drupal\node\NodeInterface;
 
 /**
@@ -21,8 +25,8 @@ class NodeRevisionController extends PluginRevisionController {
    * @return array
    *   Render array containing the revisions table for $node.
    */
-  public function revisionOverview(NodeInterface $node) {
-    return $this->formBuilder()->getForm('Drupal\diff\Form\RevisionOverviewForm', $node);
+  public function revisionOverview(NodeInterface $node): array {
+    return $this->formBuilder()->getForm(RevisionOverviewForm::class, $node);
   }
 
   /**
@@ -42,13 +46,15 @@ class NodeRevisionController extends PluginRevisionController {
    * @return array
    *   Table showing the diff between the two node revisions.
    */
-  public function compareNodeRevisions(NodeInterface $node, $left_revision, $right_revision, $filter) {
+  public function compareNodeRevisions(NodeInterface $node, $left_revision, $right_revision, $filter): array {
     $storage = $this->entityTypeManager()->getStorage('node');
     $route_match = \Drupal::routeMatch();
     $left_revision = $storage->loadRevision($left_revision);
     $right_revision = $storage->loadRevision($right_revision);
-    $build = $this->compareEntityRevisions($route_match, $left_revision, $right_revision, $filter);
-    return $build;
+    if ($left_revision instanceof ContentEntityInterface && $right_revision instanceof ContentEntityInterface) {
+      return $this->compareEntityRevisions($route_match, $left_revision, $right_revision, $filter);
+    }
+    return [];
   }
 
 }
diff --git a/src/Controller/PluginRevisionController.php b/src/Controller/PluginRevisionController.php
index 697327eea3578c21ab82119a945ddd224bef7674..41ad405e5dc19f00a2054c27c3b375318777d317 100644
--- a/src/Controller/PluginRevisionController.php
+++ b/src/Controller/PluginRevisionController.php
@@ -1,8 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Controller;
 
 use Drupal\Component\Utility\UrlHelper;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
@@ -19,59 +22,25 @@ use Symfony\Component\HttpFoundation\RequestStack;
  */
 class PluginRevisionController extends ControllerBase {
 
-  /**
-   * Wrapper object for writing/reading configuration from diff.plugins.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $config;
-
-  /**
-   * The diff entity comparison service.
-   *
-   * @var \Drupal\diff\DiffEntityComparison
-   */
-  protected $entityComparison;
-
-  /**
-   * The field diff layout plugin manager service.
-   *
-   * @var \Drupal\diff\DiffLayoutManager
-   */
-  protected $diffLayoutManager;
-
-  /**
-   * The request stack.
-   *
-   * @var \Symfony\Component\HttpFoundation\RequestStack
-   */
-  protected $requestStack;
+  protected ImmutableConfig $config;
 
   /**
    * Constructs a PluginRevisionController object.
-   *
-   * @param \Drupal\diff\DiffEntityComparison $entity_comparison
-   *   The diff entity comparison service.
-   * @param \Drupal\diff\DiffLayoutManager $diff_layout_manager
-   *   The diff layout service.
-   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
-   *   The request stack.
    */
-  public function __construct(
-    DiffEntityComparison $entity_comparison,
-    DiffLayoutManager $diff_layout_manager,
-    RequestStack $request_stack,
+  final public function __construct(
+    protected DiffEntityComparison $entityComparison,
+    protected DiffLayoutManager $diffLayoutManager,
+    protected RequestStack $requestStack,
   ) {
-    $this->config = $this->config('diff.settings');
-    $this->diffLayoutManager = $diff_layout_manager;
-    $this->entityComparison = $entity_comparison;
-    $this->requestStack = $request_stack;
+    /** @var \Drupal\Core\Config\ImmutableConfig $config */
+    $config = $this->config('diff.settings');
+    $this->config = $config;
   }
 
   /**
    * {@inheritdoc}
    */
-  public static function create(ContainerInterface $container) {
+  public static function create(ContainerInterface $container): static {
     return new static(
       $container->get('diff.entity_comparison'),
       $container->get('plugin.manager.diff.layout'),
@@ -84,13 +53,13 @@ class PluginRevisionController extends ControllerBase {
    *
    * @param \Drupal\Core\Entity\EntityStorageInterface $storage
    *   The entity storage manager.
-   * @param int $entity_id
+   * @param int|string $entity_id
    *   The entity to find revisions of.
    *
    * @return int[]
    *   The revision ids.
    */
-  public function getRevisionIds(EntityStorageInterface $storage, $entity_id) {
+  public function getRevisionIds(EntityStorageInterface $storage, int|string $entity_id): array {
     $result = $storage->getQuery()
       ->allRevisions()
       ->condition($storage->getEntityType()->getKey('id'), $entity_id)
@@ -118,10 +87,12 @@ class PluginRevisionController extends ControllerBase {
    * @return array
    *   Table showing the diff between the two entity revisions.
    */
-  public function compareEntityRevisions(RouteMatchInterface $route_match, ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, $filter) {
+  public function compareEntityRevisions(RouteMatchInterface $route_match, ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, $filter): array {
     $entity_type_id = $left_revision->getEntityTypeId();
-    /** @var \Drupal\Core\Entity\EntityInterface $entity */
     $entity = $route_match->getParameter($entity_type_id);
+    if (!$entity instanceof ContentEntityInterface) {
+      return [];
+    }
 
     $entity_type_id = $entity->getEntityTypeId();
     $storage = $this->entityTypeManager()->getStorage($entity_type_id);
@@ -156,7 +127,7 @@ class PluginRevisionController extends ControllerBase {
     ];
 
     // Build the navigation links.
-    $build['header']['diff_navigation'] = $this->buildRevisionsNavigation($entity, $revisions_ids, $left_revision->getRevisionId(), $right_revision->getRevisionId(), $filter);
+    $build['header']['diff_navigation'] = $this->buildRevisionsNavigation($entity, $revisions_ids, (int) $left_revision->getRevisionId(), (int) $right_revision->getRevisionId(), $filter);
 
     // Build the layout filter.
     $build['controls']['diff_layout'] = [
@@ -166,15 +137,12 @@ class PluginRevisionController extends ControllerBase {
       'filter' => $this->buildLayoutNavigation($entity, $left_revision->getRevisionId(), $right_revision->getRevisionId(), $filter),
     ];
 
-    // Perform comparison only if both entity revisions loaded successfully.
-    if ($left_revision != FALSE && $right_revision != FALSE) {
-      // Build the diff comparison with the plugin.
-      if ($plugin = $this->diffLayoutManager->createInstance($filter)) {
-        $build = array_merge_recursive($build, $plugin->build($left_revision, $right_revision, $entity));
-        $build['diff']['#prefix'] = '<div class="diff-responsive-table-wrapper">';
-        $build['diff']['#suffix'] = '</div>';
-        $build['diff']['#attributes']['class'][] = 'diff-responsive-table';
-      }
+    // Build the diff comparison with the plugin.
+    if ($plugin = $this->diffLayoutManager->createInstance($filter)) {
+      $build = array_merge_recursive($build, $plugin->build($left_revision, $right_revision, $entity));
+      $build['diff']['#prefix'] = '<div class="diff-responsive-table-wrapper">';
+      $build['diff']['#suffix'] = '</div>';
+      $build['diff']['#attributes']['class'][] = 'diff-responsive-table';
     }
 
     $build['#attached']['library'][] = 'diff/diff.general';
@@ -186,9 +154,9 @@ class PluginRevisionController extends ControllerBase {
    *
    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
    *   The entity to be compared.
-   * @param int $left_revision_id
+   * @param int|string $left_revision_id
    *   Revision id of the left revision.
-   * @param int $right_revision_id
+   * @param int|string $right_revision_id
    *   Revision id of the right revision.
    * @param string $active_filter
    *   The active filter.
@@ -196,13 +164,13 @@ class PluginRevisionController extends ControllerBase {
    * @return array
    *   The layout filter.
    */
-  protected function buildLayoutNavigation(ContentEntityInterface $entity, $left_revision_id, $right_revision_id, $active_filter) {
+  protected function buildLayoutNavigation(ContentEntityInterface $entity, int|string $left_revision_id, int|string $right_revision_id, string $active_filter): array {
     $links = [];
     $layouts = $this->diffLayoutManager->getPluginOptions();
     foreach ($layouts as $key => $value) {
       $links[$key] = [
         'title' => $value,
-        'url' => $this->diffRoute($entity, $left_revision_id, $right_revision_id, $key),
+        'url' => static::diffRoute($entity, $left_revision_id, $right_revision_id, $key),
       ];
     }
 
@@ -236,7 +204,7 @@ class PluginRevisionController extends ControllerBase {
    * @return array
    *   The revision navigation links.
    */
-  protected function buildRevisionsNavigation(ContentEntityInterface $entity, array $revision_ids, $left_revision_id, $right_revision_id, $filter) {
+  protected function buildRevisionsNavigation(ContentEntityInterface $entity, array $revision_ids, int $left_revision_id, int $right_revision_id, string $filter): array {
     $revisions_count = count($revision_ids);
     $layout_options = &drupal_static(__FUNCTION__);
     if (!isset($layout_options)) {
@@ -260,7 +228,7 @@ class PluginRevisionController extends ControllerBase {
       }
       if ($i != 0) {
         // Build the left link.
-        $left_link = Link::fromTextAndUrl($this->t('Previous change'), $this->diffRoute($entity, $revision_ids[$i - 1], $left_revision_id, $filter, $layout_options))->toString();
+        $left_link = Link::fromTextAndUrl($this->t('Previous change'), static::diffRoute($entity, $revision_ids[$i - 1], $left_revision_id, $filter, $layout_options))->toString();
       }
       $element['left'] = [
         '#type' => 'markup',
@@ -275,7 +243,7 @@ class PluginRevisionController extends ControllerBase {
       }
       if ($revisions_count != $i && $revision_ids[$i - 1] != $revision_ids[$revisions_count - 1]) {
         // Build the right link.
-        $right_link = Link::fromTextAndUrl($this->t('Next change'), $this->diffRoute($entity, $right_revision_id, $revision_ids[$i], $filter, $layout_options))->toString();
+        $right_link = Link::fromTextAndUrl($this->t('Next change'), static::diffRoute($entity, $right_revision_id, $revision_ids[$i], $filter, $layout_options))->toString();
       }
       $element['right'] = [
         '#type' => 'markup',
@@ -292,22 +260,22 @@ class PluginRevisionController extends ControllerBase {
    *
    * @param \Drupal\Core\Entity\ContentEntityInterface $entity
    *   The entity to be compared.
-   * @param int $left_revision_id
+   * @param int|string $left_revision_id
    *   Revision id of the left revision.
-   * @param int $right_revision_id
+   * @param int|string $right_revision_id
    *   Revision id of the right revision.
-   * @param string $layout
+   * @param string|null $layout
    *   (optional) The filter/layout added to the route.
-   * @param array $layout_options
+   * @param array|null $layout_options
    *   (optional) The layout options provided by the selected layout.
    *
    * @return \Drupal\Core\Url
    *   The URL object.
    */
-  public static function diffRoute(ContentEntityInterface $entity, $left_revision_id, $right_revision_id, $layout = NULL, array $layout_options = NULL) {
+  public static function diffRoute(ContentEntityInterface $entity, int|string $left_revision_id, int|string $right_revision_id, ?string $layout = NULL, array $layout_options = NULL): Url {
     $entity_type_id = $entity->getEntityTypeId();
     // @todo Remove the diff.revisions_diff route so we avoid adding extra cases.
-    if ($entity->getEntityTypeId() == 'node') {
+    if ($entity->getEntityTypeId() === 'node') {
       $route_name = 'diff.revisions_diff';
     }
     else {
diff --git a/src/DiffBuilderManager.php b/src/DiffBuilderManager.php
index 8bb352449058775493961f8b9ebd080c8f1f1c53..394b05a90fdf351dc66d521417552d0268ecae6d 100644
--- a/src/DiffBuilderManager.php
+++ b/src/DiffBuilderManager.php
@@ -1,15 +1,19 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Field\BaseFieldDefinition;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldStorageDefinitionInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\diff\Annotation\FieldDiffBuilder;
 use Drupal\field\Entity\FieldStorageConfig;
 
 /**
@@ -25,61 +29,24 @@ use Drupal\field\Entity\FieldStorageConfig;
  */
 class DiffBuilderManager extends DefaultPluginManager {
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * Wrapper object for simple configuration from diff.settings.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $config;
-
-  /**
-   * Wrapper object for simple configuration from diff.plugins.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $pluginsConfig;
-
-  /**
-   * Static cache of field definitions per bundle and entity type.
-   *
-   * @var array
-   */
-  protected $pluginDefinitions;
+  protected ImmutableConfig $config;
+  protected ImmutableConfig $pluginsConfig;
+  protected array $pluginDefinitions;
 
   /**
    * Constructs a DiffBuilderManager object.
-   *
-   * @param \Traversable $namespaces
-   *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations.
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
-   *   The config factory.
    */
   public function __construct(
     \Traversable $namespaces,
     CacheBackendInterface $cache_backend,
     ModuleHandlerInterface $module_handler,
-    EntityTypeManagerInterface $entity_type_manager,
+    protected EntityTypeManagerInterface $entityTypeManager,
     ConfigFactoryInterface $config_factory,
   ) {
-    parent::__construct('Plugin/diff/Field', $namespaces, $module_handler, '\Drupal\diff\FieldDiffBuilderInterface', 'Drupal\diff\Annotation\FieldDiffBuilder');
+    parent::__construct('Plugin/diff/Field', $namespaces, $module_handler, FieldDiffBuilderInterface::class, FieldDiffBuilder::class);
 
     $this->setCacheBackend($cache_backend, 'field_diff_builder_plugins');
     $this->alterInfo('field_diff_builder_info');
-    $this->entityTypeManager = $entity_type_manager;
     $this->config = $config_factory->get('diff.settings');
     $this->pluginsConfig = $config_factory->get('diff.plugins');
   }
@@ -96,7 +63,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    * @return bool
    *   TRUE if the field will be displayed.
    */
-  public function showDiff(FieldStorageDefinitionInterface $field_storage_definition) {
+  public function showDiff(FieldStorageDefinitionInterface $field_storage_definition): bool {
     $show_diff = FALSE;
     // Check if the field is revisionable.
     if ($field_storage_definition->isRevisionable()) {
@@ -128,7 +95,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    * @return \Drupal\diff\FieldDiffBuilderInterface|null
    *   The plugin instance, NULL if none.
    */
-  public function createInstanceForFieldDefinition(FieldDefinitionInterface $field_definition) {
+  public function createInstanceForFieldDefinition(FieldDefinitionInterface $field_definition): ?FieldDiffBuilderInterface {
     $selected_plugin = $this->getSelectedPluginForFieldStorageDefinition($field_definition->getFieldStorageDefinition());
     if ($selected_plugin['type'] != 'hidden') {
       return $this->createInstance($selected_plugin['type'], $selected_plugin['settings']);
@@ -149,7 +116,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    *   An array with the key type (which contains the plugin ID) and settings.
    *   The special type hidden indicates that the field should not be shown.
    */
-  public function getSelectedPluginForFieldStorageDefinition(FieldStorageDefinitionInterface $field_definition) {
+  public function getSelectedPluginForFieldStorageDefinition(FieldStorageDefinitionInterface $field_definition): array {
     $plugin_options = $this->getApplicablePluginOptions($field_definition);
     $field_key = $field_definition->getTargetEntityTypeId() . '.' . $field_definition->getName();
 
@@ -181,7 +148,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    * @return bool
    *   Whether the field is displayed.
    */
-  public function isFieldStorageDefinitionDisplayed(FieldStorageDefinitionInterface $field_storage_definition) {
+  public function isFieldStorageDefinitionDisplayed(FieldStorageDefinitionInterface $field_storage_definition): bool {
     if (($field_storage_definition instanceof BaseFieldDefinition && $field_storage_definition->isDisplayConfigurable('view')) || $field_storage_definition instanceof FieldStorageConfig) {
       $field_key = 'content.' . $field_storage_definition->getName() . '.type';
       $storage = $this->entityTypeManager->getStorage('entity_view_display');
@@ -211,7 +178,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    * @return array
    *   The plugin option for the given field based on plugin weight.
    */
-  public function getApplicablePluginOptions(FieldStorageDefinitionInterface $field_definition) {
+  public function getApplicablePluginOptions(FieldStorageDefinitionInterface $field_definition): array {
     $plugins = $this->getPluginDefinitions();
     // Build a list of all diff plugins supporting the field type of the field.
     $plugin_options = [];
@@ -223,7 +190,7 @@ class DiffBuilderManager extends DefaultPluginManager {
         $definition = $this->getDefinition($id, FALSE);
         // Check if the plugin is applicable.
         if (isset($definition['class']) && in_array($field_definition->getType(), $definition['field_types'])) {
-          /** @var FieldDiffBuilderInterface $class */
+          /** @var \Drupal\diff\FieldDiffBuilderInterface $class */
           $class = $definition['class'];
           if ($class::isApplicable($field_definition)) {
             $plugin_options[$id] = $this->getDefinitions()[$id]['label'];
@@ -243,7 +210,7 @@ class DiffBuilderManager extends DefaultPluginManager {
    * @return array
    *   The initialized plugins array sort by field type.
    */
-  public function getPluginDefinitions() {
+  public function getPluginDefinitions(): array {
     if (!isset($this->pluginDefinitions)) {
       // Get the definition of all the FieldDiffBuilder plugins.
       foreach ($this->getDefinitions() as $plugin_definition) {
@@ -266,7 +233,7 @@ class DiffBuilderManager extends DefaultPluginManager {
   /**
    * Clear the pluginDefinitions local property array.
    */
-  public function clearCachedDefinitions() {
+  public function clearCachedDefinitions(): void {
     unset($this->pluginDefinitions);
   }
 
diff --git a/src/DiffEntityComparison.php b/src/DiffEntityComparison.php
index ddc1c9db83a178cb96d99d6debc322f2b131630e..eddde018c0e56c669a3263a5b7c706e5ca7a5386 100644
--- a/src/DiffEntityComparison.php
+++ b/src/DiffEntityComparison.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Component\Diff\Diff;
@@ -7,6 +9,7 @@ use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Component\Utility\Xss;
 use Drupal\content_moderation\ModerationInformationInterface;
 use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\RevisionLogInterface;
 
@@ -15,82 +18,22 @@ use Drupal\Core\Entity\RevisionLogInterface;
  */
 class DiffEntityComparison {
 
-  /**
-   * Contains the configuration object factory.
-   *
-   * @var \Drupal\Core\Config\ConfigFactoryInterface
-   */
-  protected $configFactory;
-
-  /**
-   * Wrapper object for simple configuration from diff.plugins.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $pluginsConfig;
-
-  /**
-   * The diff formatter.
-   *
-   * @var \Drupal\Core\Diff\DiffFormatter
-   */
-  protected $diffFormatter;
-
-  /**
-   * A list of all the field types from the system and their definitions.
-   *
-   * @var array
-   */
-  protected $fieldTypeDefinitions;
-
-  /**
-   * The entity parser.
-   *
-   * @var \Drupal\diff\DiffEntityParser
-   */
-  protected $entityParser;
-
-  /**
-   * The field diff plugin manager service.
-   *
-   * @var \Drupal\diff\DiffBuilderManager
-   */
-  protected $diffBuilderManager;
-
-  /**
-   * The content moderation service, if available.
-   *
-   * @var \Drupal\content_moderation\ModerationInformationInterface
-   */
-  protected $moderationInformation;
+  protected ImmutableConfig $pluginsConfig;
+  protected array $fieldTypeDefinitions;
+  protected ?ModerationInformationInterface $moderationInformation = NULL;
 
   /**
    * Constructs a DiffEntityComparison object.
-   *
-   * @param \Drupal\Core\Config\ConfigFactory $config_factory
-   *   The configuration factory.
-   * @param \Drupal\diff\DiffFormatter $diff_formatter
-   *   The diff formatter service.
-   * @param \Drupal\Component\Plugin\PluginManagerInterface $plugin_manager
-   *   The plugin manager service.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\diff\DiffBuilderManager $diff_builder_manager
-   *   The diff builder manager.
    */
   public function __construct(
-    ConfigFactory $config_factory,
-    DiffFormatter $diff_formatter,
+    protected ConfigFactory $configFactory,
+    protected DiffFormatter $diffFormatter,
     PluginManagerInterface $plugin_manager,
-    DiffEntityParser $entity_parser,
-    DiffBuilderManager $diff_builder_manager,
+    protected DiffEntityParser $entityParser,
+    protected DiffBuilderManager $diffBuilderManager,
   ) {
-    $this->configFactory = $config_factory;
     $this->pluginsConfig = $this->configFactory->get('diff.plugins');
-    $this->diffFormatter = $diff_formatter;
     $this->fieldTypeDefinitions = $plugin_manager->getDefinitions();
-    $this->entityParser = $entity_parser;
-    $this->diffBuilderManager = $diff_builder_manager;
   }
 
   /**
@@ -104,7 +47,7 @@ class DiffEntityComparison {
    * @return array
    *   Items ready to be compared by the Diff component.
    */
-  public function compareRevisions(ContentEntityInterface $left_entity, ContentEntityInterface $right_entity) {
+  public function compareRevisions(ContentEntityInterface $left_entity, ContentEntityInterface $right_entity): array {
     $result = [];
 
     $left_values = $this->entityParser->parseEntity($left_entity);
@@ -159,7 +102,7 @@ class DiffEntityComparison {
    * @return array
    *   Array resulted after combining the left and right values.
    */
-  protected function combineFields(array $left_values, array $right_values) {
+  protected function combineFields(array $left_values, array $right_values): array {
     $result = [
       '#left' => [],
       '#right' => [],
@@ -214,7 +157,7 @@ class DiffEntityComparison {
    *   Array of rows usable with #type => 'table' returned by the core diff
    *   formatter when format a diff.
    */
-  public function getRows($a, $b, $show_header = FALSE, array &$line_stats = NULL) {
+  public function getRows($a, $b, $show_header = FALSE, array &$line_stats = NULL): array {
     if (!isset($line_stats)) {
       $line_stats = [
         'counter' => ['x' => 0, 'y' => 0],
@@ -235,7 +178,7 @@ class DiffEntityComparison {
    * @param array $diff
    *   Array of strings.
    */
-  public function processStateLine(array &$diff) {
+  public function processStateLine(array &$diff): void {
     $data = $diff['#data'];
     if (isset($data['#left']) && $data['#left'] != '') {
       if (is_string($data['#left'])) {
@@ -270,7 +213,7 @@ class DiffEntityComparison {
    * @return string
    *   The revision log message.
    */
-  public function getRevisionDescription(ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL) {
+  public function getRevisionDescription(ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL): string {
     $revision_summary = '';
     // Check if the revision has a revision log message.
     if ($revision instanceof RevisionLogInterface) {
@@ -299,7 +242,7 @@ class DiffEntityComparison {
    * @return array
    *   Array of the revision fields with their value and label.
    */
-  protected function summary(ContentEntityInterface $revision) {
+  protected function summary(ContentEntityInterface $revision): array {
     $result = [];
     $entity_type_id = $revision->getEntityTypeId();
     // Loop through entity fields and transform every FieldItemList object
@@ -346,8 +289,8 @@ class DiffEntityComparison {
    * @return string|bool
    *   Returns the label of the moderation state, if available, otherwise FALSE.
    */
-  protected function getModerationState(ContentEntityInterface $entity) {
-    if ($this->moderationInformation && $this->moderationInformation->isModeratedEntity($entity)) {
+  protected function getModerationState(ContentEntityInterface $entity): string|bool {
+    if ($this->moderationInformation instanceof ModerationInformationInterface && $this->moderationInformation->isModeratedEntity($entity)) {
       if ($state = $entity->moderation_state->value) {
         $workflow = $this->moderationInformation->getWorkflowForEntity($entity);
         return $workflow->getTypePlugin()->getState($state)->label();
@@ -363,7 +306,7 @@ class DiffEntityComparison {
    * @param \Drupal\content_moderation\ModerationInformationInterface $moderation_information
    *   The moderation information service.
    */
-  public function setModerationInformation(ModerationInformationInterface $moderation_information) {
+  public function setModerationInformation(ModerationInformationInterface $moderation_information): void {
     $this->moderationInformation = $moderation_information;
   }
 
diff --git a/src/DiffEntityParser.php b/src/DiffEntityParser.php
index 10badb2676947b7be0daf88fb36afd4551f7fced..1984430880db7e4361d739d45993b23e77301706 100644
--- a/src/DiffEntityParser.php
+++ b/src/DiffEntityParser.php
@@ -1,8 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Language\LanguageInterface;
 
@@ -11,42 +14,18 @@ use Drupal\Core\Language\LanguageInterface;
  */
 class DiffEntityParser {
 
-  /**
-   * The diff field builder plugin manager.
-   *
-   * @var \Drupal\diff\DiffBuilderManager
-   */
-  protected $diffBuilderManager;
-
-  /**
-   * Wrapper object for simple configuration from diff.settings.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $config;
-
-  /**
-   * Wrapper object for simple configuration from diff.plugins.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $pluginsConfig;
+  protected ImmutableConfig $config;
+  protected ImmutableConfig $pluginsConfig;
 
   /**
    * Constructs a DiffEntityParser object.
-   *
-   * @param \Drupal\diff\DiffBuilderManager $diff_builder_manager
-   *   The diff builder manager.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
-   *   The configuration factory.
    */
   public function __construct(
-    DiffBuilderManager $diff_builder_manager,
+    protected DiffBuilderManager $diffBuilderManager,
     ConfigFactoryInterface $config_factory,
   ) {
     $this->config = $config_factory->get('diff.settings');
     $this->pluginsConfig = $config_factory->get('diff.plugins');
-    $this->diffBuilderManager = $diff_builder_manager;
   }
 
   /**
@@ -62,7 +41,7 @@ class DiffEntityParser {
    * @return array
    *   Array of strings resulted by parsing the entity.
    */
-  public function parseEntity(ContentEntityInterface $entity) {
+  public function parseEntity(ContentEntityInterface $entity): array {
     $result = [];
     $langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
     // Load entity of current language, otherwise fields are always compared by
diff --git a/src/DiffFormatter.php b/src/DiffFormatter.php
index 98c272b05b9c8906f9a4d3f58226aef8929d958e..2008159dc32592c6a165fd2cafea72832fdb792a 100644
--- a/src/DiffFormatter.php
+++ b/src/DiffFormatter.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
diff --git a/src/DiffLayoutBase.php b/src/DiffLayoutBase.php
index 11ce99201cbe5711c6d96f51db352857cb3fa8cb..4c986def8dd2f12fcfcea6d800f981e70668b36f 100644
--- a/src/DiffLayoutBase.php
+++ b/src/DiffLayoutBase.php
@@ -1,16 +1,18 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Component\Plugin\PluginBase;
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Datetime\DateFormatter;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\RevisionLogInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\GeneratedLink;
 use Drupal\Core\Link;
 use Drupal\Core\Mail\MailFormatHelper;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
@@ -26,66 +28,19 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
 
   use StringTranslationTrait;
 
-  /**
-   * Contains the configuration object factory.
-   *
-   * @var \Drupal\Core\Config\ConfigFactoryInterface
-   */
-  protected $configFactory;
-
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * The entity parser.
-   *
-   * @var \Drupal\diff\DiffEntityParser
-   */
-  protected $entityParser;
-
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\DateFormatterInterface
-   */
-  protected $date;
-
   /**
    * Constructs a DiffLayoutBase object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
-   *   The configuration factory object.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\Core\Datetime\DateFormatterInterface $date
-   *   The date service.
    */
   public function __construct(
     array $configuration,
     $plugin_id,
     $plugin_definition,
-    ConfigFactoryInterface $config,
-    EntityTypeManagerInterface $entity_type_manager,
-    DiffEntityParser $entity_parser,
-    DateFormatterInterface $date,
+    protected ConfigFactoryInterface $configFactory,
+    protected EntityTypeManagerInterface $entityTypeManager,
+    protected DiffEntityParser $entityParser,
+    protected DateFormatterInterface $date,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-    $this->configFactory = $config;
-    $this->entityTypeManager = $entity_type_manager;
-    $this->entityParser = $entity_parser;
-    $this->date = $date;
     $this->configuration += $this->defaultConfiguration();
   }
 
@@ -110,19 +65,15 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
    * @param \Drupal\Core\Entity\ContentEntityInterface $revision
    *   A revision where to add a link.
    *
-   * @return \Drupal\Core\Link
+   * @return \Drupal\Core\GeneratedLink
    *   Header link for a revision in the table.
    */
-  protected function buildRevisionLink(ContentEntityInterface $revision) {
+  protected function buildRevisionLink(ContentEntityInterface $revision): GeneratedLink {
     if ($revision instanceof RevisionLogInterface) {
       $revision_date = $this->date->format($revision->getRevisionCreationTime(), 'short');
-      $revision_link = Link::fromTextAndUrl($revision_date, $revision->toUrl('revision'))->toString();
+      return Link::fromTextAndUrl($revision_date, $revision->toUrl('revision'))->toString();
     }
-    else {
-      $revision_link = Link::fromTextAndUrl($revision->label(), $revision->toUrl('revision'))
-        ->toString();
-    }
-    return $revision_link;
+    return Link::fromTextAndUrl($revision->label(), $revision->toUrl('revision'))->toString();
   }
 
   /**
@@ -136,7 +87,7 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
    * @return array
    *   Header link for a revision in the revision comparison display.
    */
-  public function buildRevisionsData(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision) {
+  public function buildRevisionsData(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision): array {
     $right_revision = $this->buildRevisionData($right_revision);
     $right_revision['#prefix'] = '<div class="diff-revision__items-group">';
     $right_revision['#suffix'] = '</div>';
@@ -172,7 +123,7 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
    * @return array
    *   Revision data about author, creation date and log.
    */
-  protected function buildRevisionData(ContentEntityInterface $revision) {
+  protected function buildRevisionData(ContentEntityInterface $revision): array {
     if ($revision instanceof RevisionLogInterface) {
       $revision_log = $revision->getRevisionLogMessage();
       $user_id = $revision->getRevisionUserId();
@@ -233,7 +184,7 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
    * @return array
    *   The filter options.
    */
-  protected function buildFilterNavigation(ContentEntityInterface $entity, ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, $layout, $active_filter) {
+  protected function buildFilterNavigation(ContentEntityInterface $entity, ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, $layout, $active_filter): array {
     // Build the view modes filter.
     $options['raw'] = [
       'title' => $this->t('Raw'),
@@ -278,7 +229,7 @@ abstract class DiffLayoutBase extends PluginBase implements DiffLayoutInterface,
    * @return array|string
    *   Result after markdown was applied on $items.
    */
-  protected function applyMarkdown($markdown, $items) {
+  protected function applyMarkdown($markdown, $items): array|string {
     if (!$markdown) {
       return $items;
     }
diff --git a/src/DiffLayoutInterface.php b/src/DiffLayoutInterface.php
index ebd71070c23d16cac39207ce5b335c7b7fa69732..a29ede18820c11363b9c02cc1306051bd6b0e51b 100644
--- a/src/DiffLayoutInterface.php
+++ b/src/DiffLayoutInterface.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Component\Plugin\ConfigurableInterface;
@@ -28,6 +30,6 @@ interface DiffLayoutInterface extends PluginFormInterface, ConfigurableInterface
    * @return array
    *   The modified build array that the plugin builds.
    */
-  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity);
+  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity): array;
 
 }
diff --git a/src/DiffLayoutManager.php b/src/DiffLayoutManager.php
index a15992ce844dce21db6ee67a24e694ec0503972b..7ef1723aad5048e9f08727010adc148f1a0e626f 100644
--- a/src/DiffLayoutManager.php
+++ b/src/DiffLayoutManager.php
@@ -1,68 +1,39 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Cache\CacheBackendInterface;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\diff\Annotation\DiffLayoutBuilder;
 
 /**
  * Plugin type manager for field diff builders.
- *
- * @ingroup diff_layout_builder
  */
 class DiffLayoutManager extends DefaultPluginManager {
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * Wrapper object for simple configuration from diff.settings.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $config;
-
-  /**
-   * Wrapper object for simple configuration from diff.plugins.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $layoutPluginsConfig;
+  protected ImmutableConfig $config;
+  protected ImmutableConfig $layoutPluginsConfig;
 
   /**
    * Constructs a DiffLayoutManager object.
-   *
-   * @param \Traversable $namespaces
-   *   An object that implements \Traversable which contains the root paths
-   *   keyed by the corresponding namespace to look for plugin implementations.
-   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
-   *   Cache backend instance to use.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
-   *   The configuration factory.
    */
   public function __construct(
     \Traversable $namespaces,
     CacheBackendInterface $cache_backend,
     ModuleHandlerInterface $module_handler,
-    EntityTypeManagerInterface $entity_type_manager,
+    protected EntityTypeManagerInterface $entityTypeManager,
     ConfigFactoryInterface $config_factory,
   ) {
-    parent::__construct('Plugin/diff/Layout', $namespaces, $module_handler, '\Drupal\diff\DiffLayoutInterface', 'Drupal\diff\Annotation\DiffLayoutBuilder');
+    parent::__construct('Plugin/diff/Layout', $namespaces, $module_handler, DiffLayoutInterface::class, DiffLayoutBuilder::class);
 
     $this->setCacheBackend($cache_backend, 'diff_layout_builder_plugins');
     $this->alterInfo('diff_layout_builder_info');
-    $this->entityTypeManager = $entity_type_manager;
     $this->config = $config_factory->get('diff.settings');
     $this->layoutPluginsConfig = $config_factory->get('diff.layout_plugins');
   }
@@ -76,7 +47,7 @@ class DiffLayoutManager extends DefaultPluginManager {
    * @return array
    *   The layout plugin options.
    */
-  public function getPluginOptions() {
+  public function getPluginOptions(): array {
     $plugins = $this->config->get('general_settings.layout_plugins');
     $plugin_options = [];
     // Get the plugins sorted and build an array keyed by the plugin id.
@@ -103,7 +74,7 @@ class DiffLayoutManager extends DefaultPluginManager {
    * @return string
    *   The id of the default plugin.
    */
-  public function getDefaultLayout() {
+  public function getDefaultLayout(): string {
     $plugins = array_keys($this->getPluginOptions());
     return reset($plugins);
   }
diff --git a/src/FieldDiffBuilderBase.php b/src/FieldDiffBuilderBase.php
index 8b96dd5a9ba18a026727b3f823eaba127b089694..8aa1304639500ddcfa49303dbd048c266e2b3f5a 100644
--- a/src/FieldDiffBuilderBase.php
+++ b/src/FieldDiffBuilderBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -14,52 +16,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 abstract class FieldDiffBuilderBase extends PluginBase implements FieldDiffBuilderInterface, ContainerFactoryPluginInterface {
 
-  /**
-   * Contains the configuration object factory.
-   *
-   * @var \Drupal\Core\Config\ConfigFactoryInterface
-   */
-  protected $configFactory;
-
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * The entity parser.
-   *
-   * @var \Drupal\diff\DiffEntityParser
-   */
-  protected $entityParser;
-
   /**
    * Constructs a FieldDiffBuilderBase object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
    */
   public function __construct(
     array $configuration,
     $plugin_id,
     $plugin_definition,
-    EntityTypeManagerInterface $entity_type_manager,
-    DiffEntityParser $entity_parser,
+    protected EntityTypeManagerInterface $entityTypeManager,
+    protected DiffEntityParser $entityParser,
   ) {
-    $this->entityTypeManager = $entity_type_manager;
-    $this->entityParser = $entity_parser;
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-
     $this->configuration += $this->defaultConfiguration();
   }
 
@@ -79,7 +46,7 @@ abstract class FieldDiffBuilderBase extends PluginBase implements FieldDiffBuild
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['show_header'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Show field title'),
@@ -104,14 +71,14 @@ abstract class FieldDiffBuilderBase extends PluginBase implements FieldDiffBuild
   /**
    * {@inheritdoc}
    */
-  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function validateConfigurationForm(array &$form, FormStateInterface $form_state): void {
     // By default an empty validation function is provided.
   }
 
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['show_header'] = $form_state->getValue('show_header');
     $this->configuration['markdown'] = $form_state->getValue('markdown');
   }
@@ -119,7 +86,7 @@ abstract class FieldDiffBuilderBase extends PluginBase implements FieldDiffBuild
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     return [
       'show_header' => 1,
       'markdown' => 'drupal_html_to_text',
@@ -143,7 +110,7 @@ abstract class FieldDiffBuilderBase extends PluginBase implements FieldDiffBuild
   /**
    * {@inheritdoc}
    */
-  public static function isApplicable(FieldStorageDefinitionInterface $field_definition) {
+  public static function isApplicable(FieldStorageDefinitionInterface $field_definition): bool {
     return TRUE;
   }
 
diff --git a/src/FieldDiffBuilderInterface.php b/src/FieldDiffBuilderInterface.php
index e8206de76d05308e5363244e5dbef0e7d6a70c0c..9d0356312f9f7edc3d218790b08fb8c5bf76de10 100644
--- a/src/FieldDiffBuilderInterface.php
+++ b/src/FieldDiffBuilderInterface.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Component\Plugin\ConfigurableInterface;
@@ -38,7 +40,7 @@ interface FieldDiffBuilderInterface extends PluginFormInterface, ConfigurableInt
    *   means that a field is either empty or no properties need to be compared
    *   for that field.
    */
-  public function build(FieldItemListInterface $field_items);
+  public function build(FieldItemListInterface $field_items): mixed;
 
   /**
    * Returns if the plugin can be used for the provided field.
@@ -49,6 +51,6 @@ interface FieldDiffBuilderInterface extends PluginFormInterface, ConfigurableInt
    * @return bool
    *   TRUE if the plugin can be used, FALSE otherwise.
    */
-  public static function isApplicable(FieldStorageDefinitionInterface $field_definition);
+  public static function isApplicable(FieldStorageDefinitionInterface $field_definition): bool;
 
 }
diff --git a/src/FieldReferenceInterface.php b/src/FieldReferenceInterface.php
index c6f7957eaec211eed18858b2e93466a8da1034ab..8ee3fea6b6d5ce0faa07f4031b3ebfaf0fa6a0e6 100644
--- a/src/FieldReferenceInterface.php
+++ b/src/FieldReferenceInterface.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Component\Plugin\ConfigurableInterface;
@@ -26,6 +28,6 @@ interface FieldReferenceInterface extends PluginFormInterface, ConfigurableInter
    *   means that a field is either empty or no properties need to be compared
    *   for that field.
    */
-  public function getEntitiesToDiff(FieldItemListInterface $field_items);
+  public function getEntitiesToDiff(FieldItemListInterface $field_items): array;
 
 }
diff --git a/src/Form/FieldsSettingsForm.php b/src/Form/FieldsSettingsForm.php
index 9e040663eeedf6ac24da25b742d336beec3ce716..fd9208a9e316692124672e18e815e292bbe60dae 100644
--- a/src/Form/FieldsSettingsForm.php
+++ b/src/Form/FieldsSettingsForm.php
@@ -1,10 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Form;
 
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Core\Entity\EntityFieldManagerInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -13,6 +14,7 @@ use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormState;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\diff\DiffBuilderManager;
+use Drupal\diff\FieldDiffBuilderInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -24,51 +26,17 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 class FieldsSettingsForm extends ConfigFormBase {
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * The entity field manager.
-   *
-   * @var \Drupal\Core\Entity\EntityFieldManagerInterface
-   */
-  protected $entityFieldManager;
-
-  /**
-   * The field type plugin manager service.
-   *
-   * @var \Drupal\Component\Plugin\PluginManagerInterface
-   */
-  protected $fieldTypePluginManager;
-
-  /**
-   * The field diff plugin manager service.
-   *
-   * @var \Drupal\diff\DiffBuilderManager
-   */
-  protected $diffBuilderManager;
-
   /**
    * Constructs a FieldsSettingsForm object.
    */
   public function __construct(
     ConfigFactoryInterface $config_factory,
-    TypedConfigManagerInterface $typedConfigManager,
-    PluginManagerInterface $plugin_manager,
-    DiffBuilderManager $diff_builder_manager,
-    EntityTypeManagerInterface $entity_type_manager,
-    EntityFieldManagerInterface $entity_field_manager,
+    protected PluginManagerInterface $fieldTypePluginManager,
+    protected DiffBuilderManager $diffBuilderManager,
+    protected EntityTypeManagerInterface $entityTypeManager,
+    protected EntityFieldManagerInterface $entityFieldManager,
   ) {
-    parent::__construct($config_factory, $typedConfigManager);
-
-    $this->fieldTypePluginManager = $plugin_manager;
-    $this->diffBuilderManager = $diff_builder_manager;
-    $this->entityTypeManager = $entity_type_manager;
-    $this->entityFieldManager = $entity_field_manager;
+    parent::__construct($config_factory);
   }
 
   /**
@@ -77,7 +45,6 @@ class FieldsSettingsForm extends ConfigFormBase {
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('config.factory'),
-      $container->get('config.typed'),
       $container->get('plugin.manager.field.field_type'),
       $container->get('plugin.manager.diff.builder'),
       $container->get('entity_type.manager'),
@@ -88,21 +55,21 @@ class FieldsSettingsForm extends ConfigFormBase {
   /**
    * {@inheritdoc}
    */
-  public function getFormId() {
+  public function getFormId(): string {
     return 'diff_admin_plugins';
   }
 
   /**
    * {@inheritdoc}
    */
-  protected function getEditableConfigNames() {
+  protected function getEditableConfigNames(): array {
     return ['diff.plugins'];
   }
 
   /**
    * {@inheritdoc}
    */
-  public function buildForm(array $form, FormStateInterface $form_state) {
+  public function buildForm(array $form, FormStateInterface $form_state): array {
     $form = parent::buildForm($form, $form_state);
     // The table containing all the field types discovered in the system.
     $form['fields'] = [
@@ -166,7 +133,7 @@ class FieldsSettingsForm extends ConfigFormBase {
    * @return array
    *   A table row for the field type listing table.
    */
-  protected function buildFieldRow(EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $field_definition, FormStateInterface $form_state) {
+  protected function buildFieldRow(EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $field_definition, FormStateInterface $form_state): array {
     $entity_type_label = $entity_type->getLabel();
     $field_name = $field_definition->getName();
     $field_type = $field_definition->getType();
@@ -316,7 +283,7 @@ class FieldsSettingsForm extends ConfigFormBase {
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    *   The form state object.
    */
-  public function multiStepSubmit(array $form, FormStateInterface $form_state) {
+  public function multiStepSubmit(array $form, FormStateInterface $form_state): void {
     $trigger = $form_state->getTriggeringElement();
     $op = $trigger['#op'];
 
@@ -356,7 +323,7 @@ class FieldsSettingsForm extends ConfigFormBase {
    * @return array
    *   The fields form for a plugin.
    */
-  public function multiStepAjax(array $form, FormStateInterface $form_state) {
+  public function multiStepAjax(array $form, FormStateInterface $form_state): array {
     $trigger = $form_state->getTriggeringElement();
     if (isset($trigger['#op'])) {
       $op = $trigger['#op'];
@@ -392,7 +359,7 @@ class FieldsSettingsForm extends ConfigFormBase {
   /**
    * {@inheritdoc}
    */
-  public function validateForm(array &$form, FormStateInterface $form_state) {
+  public function validateForm(array &$form, FormStateInterface $form_state): void {
     $form_values = $form_state->getValues();
     $plugin_settings = $form_state->get('plugin_settings');
     $fields = $form_values['fields'];
@@ -436,7 +403,7 @@ class FieldsSettingsForm extends ConfigFormBase {
   /**
    * {@inheritdoc}
    */
-  public function submitForm(array &$form, FormStateInterface $form_state) {
+  public function submitForm(array &$form, FormStateInterface $form_state): void {
     $form_values = $form_state->getValues();
     $plugin_settings = $form_state->get('plugin_settings');
     $fields = $form_values['fields'];
@@ -445,7 +412,7 @@ class FieldsSettingsForm extends ConfigFormBase {
 
     // Save the settings.
     foreach ($fields as $field_key => $field_values) {
-      $config_key = preg_replace('/__/', '.', $field_key, 1);
+      $config_key = preg_replace('/__/', '.', (string) $field_key, 1);
       if ($field_values['plugin']['type'] == 'hidden') {
         $config->set('fields.' . $config_key, ['type' => 'hidden', 'settings' => []]);
       }
@@ -494,20 +461,16 @@ class FieldsSettingsForm extends ConfigFormBase {
 
   /**
    * Returns a plugin object or NULL if no plugin could be found.
-   *
-   * @param array $configuration
-   *   The plugin configuration.
-   *
-   * @return \Drupal\diff\FieldDiffBuilderInterface|null
-   *   The plugin.
    */
-  protected function getPlugin(array $configuration) {
+  protected function getPlugin(array $configuration): ?FieldDiffBuilderInterface {
     if ($configuration && isset($configuration['type']) && $configuration['type'] != 'hidden') {
       if (!isset($configuration['settings'])) {
         $configuration['settings'] = [];
       }
+      /** @var \Drupal\diff\FieldDiffBuilderInterface */
       return $this->diffBuilderManager->createInstance(
-        $configuration['type'], $configuration['settings'],
+        $configuration['type'],
+        $configuration['settings'],
       );
     }
 
@@ -517,7 +480,7 @@ class FieldsSettingsForm extends ConfigFormBase {
   /**
    * Returns the header for the table.
    */
-  protected function getTableHeader() {
+  protected function getTableHeader(): array {
     return [
       'entity_type' => $this->t('Entity Type'),
       'field_name' => $this->t('Field'),
diff --git a/src/Form/GeneralSettingsForm.php b/src/Form/GeneralSettingsForm.php
index 74c5d53ff3f5fcda7cf42ff9d08d301d43be57af..b51255b7e920f0cc162efef5ec8658c86a96aede 100644
--- a/src/Form/GeneralSettingsForm.php
+++ b/src/Form/GeneralSettingsForm.php
@@ -1,10 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Form;
 
 use Drupal\Component\Utility\Xss;
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Config\TypedConfigManagerInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\diff\DiffLayoutManager;
@@ -15,24 +16,14 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 class GeneralSettingsForm extends ConfigFormBase {
 
-  /**
-   * The field diff layout plugin manager service.
-   *
-   * @var \Drupal\diff\DiffLayoutManager
-   */
-  protected $diffLayoutManager;
-
   /**
    * GeneralSettingsForm constructor.
    */
   public function __construct(
     ConfigFactoryInterface $config_factory,
-    TypedConfigManagerInterface $typedConfigManager,
-    DiffLayoutManager $diff_layout_manager,
+    protected DiffLayoutManager $diffLayoutManager,
   ) {
-    parent::__construct($config_factory, $typedConfigManager);
-
-    $this->diffLayoutManager = $diff_layout_manager;
+    parent::__construct($config_factory);
   }
 
   /**
@@ -41,7 +32,6 @@ class GeneralSettingsForm extends ConfigFormBase {
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('config.factory'),
-      $container->get('config.typed'),
       $container->get('plugin.manager.diff.layout'),
     );
   }
diff --git a/src/Form/RevisionOverviewForm.php b/src/Form/RevisionOverviewForm.php
index be03826f4c1e5f07722be0a9157e67e1e4c85bbb..5f968b4997d9cb5a0fd8cd3c42fc1102b8c6f059 100755
--- a/src/Form/RevisionOverviewForm.php
+++ b/src/Form/RevisionOverviewForm.php
@@ -1,8 +1,11 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Form;
 
 use Drupal\Component\Utility\Xss;
+use Drupal\Core\Config\ImmutableConfig;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -22,97 +25,21 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 class RevisionOverviewForm extends FormBase {
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
-  /**
-   * The current user service.
-   *
-   * @var \Drupal\Core\Session\AccountInterface
-   */
-  protected $currentUser;
-
-  /**
-   * The date service.
-   *
-   * @var \Drupal\Core\Datetime\DateFormatterInterface
-   */
-  protected $date;
-
-  /**
-   * The renderer service.
-   *
-   * @var \Drupal\Core\Render\RendererInterface
-   */
-  protected $renderer;
-
-  /**
-   * The language manager.
-   *
-   * @var \Drupal\Core\Language\LanguageManagerInterface
-   */
-  protected $languageManager;
-
-  /**
-   * Wrapper object for simple configuration from diff.settings.yml.
-   *
-   * @var \Drupal\Core\Config\ImmutableConfig
-   */
-  protected $config;
-
-  /**
-   * The field diff layout plugin manager service.
-   *
-   * @var \Drupal\diff\DiffLayoutManager
-   */
-  protected $diffLayoutManager;
-
-  /**
-   * The diff entity comparison service.
-   *
-   * @var \Drupal\diff\DiffEntityComparison
-   */
-  protected $entityComparison;
+  protected ImmutableConfig $config;
 
   /**
    * Constructs a RevisionOverviewForm object.
-   *
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\Core\Session\AccountInterface $current_user
-   *   The current user.
-   * @param \Drupal\Core\Datetime\DateFormatterInterface $date
-   *   The date service.
-   * @param \Drupal\Core\Render\RendererInterface $renderer
-   *   The renderer service.
-   * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
-   *   The language manager.
-   * @param \Drupal\diff\DiffLayoutManager $diff_layout_manager
-   *   The diff layout service.
-   * @param \Drupal\diff\DiffEntityComparison $entity_comparison
-   *   The diff entity comparison service.
    */
   public function __construct(
-    EntityTypeManagerInterface $entity_type_manager,
-    AccountInterface $current_user,
-    DateFormatterInterface $date,
-    RendererInterface $renderer,
-    LanguageManagerInterface $language_manager,
-    DiffLayoutManager $diff_layout_manager,
-    DiffEntityComparison $entity_comparison,
+    protected EntityTypeManagerInterface $entityTypeManager,
+    protected AccountInterface $currentUser,
+    protected DateFormatterInterface $date,
+    protected RendererInterface $renderer,
+    protected LanguageManagerInterface $languageManager,
+    protected DiffLayoutManager $diffLayoutManager,
+    protected DiffEntityComparison $entityComparison,
   ) {
-    $this->entityTypeManager = $entity_type_manager;
-    $this->currentUser = $current_user;
-    $this->date = $date;
-    $this->renderer = $renderer;
-    $this->languageManager = $language_manager;
     $this->config = $this->config('diff.settings');
-    $this->diffLayoutManager = $diff_layout_manager;
-    $this->entityComparison = $entity_comparison;
   }
 
   /**
@@ -330,7 +257,7 @@ class RevisionOverviewForm extends FormBase {
    * @return array
    *   Configuration array.
    */
-  protected function buildSelectColumn($name, $return_val, $default_val) {
+  protected function buildSelectColumn($name, $return_val, $default_val): array {
     return [
       '#type' => 'radio',
       '#title_display' => 'invisible',
@@ -356,7 +283,7 @@ class RevisionOverviewForm extends FormBase {
    * @return array
    *   Configuration for revision.
    */
-  protected function buildRevision(Link $link, $username, ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL) {
+  protected function buildRevision(Link $link, $username, ContentEntityInterface $revision, ContentEntityInterface $previous_revision = NULL): array {
     return [
       '#type' => 'inline_template',
       '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}',
diff --git a/src/Plugin/diff/Field/CommentFieldBuilder.php b/src/Plugin/diff/Field/CommentFieldBuilder.php
index 40c7479ff4a1798e85ce04f30d4ad52dfdedd414..eff8e0fdee7349f8261ddc25fac25fec5e8be43a 100644
--- a/src/Plugin/diff/Field/CommentFieldBuilder.php
+++ b/src/Plugin/diff/Field/CommentFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
@@ -23,7 +25,7 @@ class CommentFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
 
     // Every item from $field_items is of type FieldItemInterface.
@@ -63,7 +65,7 @@ class CommentFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['compare_key'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Compare comment status key'),
@@ -81,7 +83,7 @@ class CommentFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['compare_key'] = $form_state->getValue('compare_key');
     $this->configuration['compare_string'] = $form_state->getValue('compare_string');
 
@@ -91,7 +93,7 @@ class CommentFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'compare_key' => 0,
       'compare_string' => 1,
diff --git a/src/Plugin/diff/Field/CoreFieldBuilder.php b/src/Plugin/diff/Field/CoreFieldBuilder.php
index fef72dc60d516878ad1b6c45a6ded9960b46e97c..b11d740677816a5b29fcd50e4bed415e3ff7dede 100644
--- a/src/Plugin/diff/Field/CoreFieldBuilder.php
+++ b/src/Plugin/diff/Field/CoreFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -23,28 +25,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 class CoreFieldBuilder extends FieldDiffBuilderBase {
 
-  /**
-   * The renderer.
-   *
-   * @var \Drupal\Core\Render\RendererInterface
-   */
-  protected $renderer;
-
   /**
    * Constructs a CoreFieldBuilder object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\Core\Render\RendererInterface $renderer
-   *   The renderer.
    */
   public function __construct(
     array $configuration,
@@ -52,10 +34,9 @@ class CoreFieldBuilder extends FieldDiffBuilderBase {
     $plugin_definition,
     EntityTypeManagerInterface $entity_type_manager,
     DiffEntityParser $entity_parser,
-    RendererInterface $renderer,
+    protected RendererInterface $renderer,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_parser);
-    $this->renderer = $renderer;
   }
 
   /**
@@ -75,7 +56,7 @@ class CoreFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
 
     // Every item from $field_items is of type FieldItemInterface.
diff --git a/src/Plugin/diff/Field/EntityReferenceFieldBuilder.php b/src/Plugin/diff/Field/EntityReferenceFieldBuilder.php
index f1df5f0555193b6f2f13d29d50091f6417af5718..5a4dd9f58fb7a7128ad06dd79c587d26e96c554b 100644
--- a/src/Plugin/diff/Field/EntityReferenceFieldBuilder.php
+++ b/src/Plugin/diff/Field/EntityReferenceFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -26,7 +28,7 @@ class EntityReferenceFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
     // Every item from $field_items is of type FieldItemInterface.
     foreach ($field_items as $field_key => $field_item) {
@@ -54,7 +56,7 @@ class EntityReferenceFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['compare_entity_reference'] = [
       '#type' => 'select',
       '#title' => $this->t('Compare'),
@@ -68,7 +70,7 @@ class EntityReferenceFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['compare_entity_reference'] = $form_state->getValue('compare_entity_reference');
 
     parent::submitConfigurationForm($form, $form_state);
@@ -77,7 +79,7 @@ class EntityReferenceFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'compare_entity_reference' => COMPARE_ENTITY_REFERENCE_LABEL,
     ];
diff --git a/src/Plugin/diff/Field/FileFieldBuilder.php b/src/Plugin/diff/Field/FileFieldBuilder.php
index 6381ebb25a4b85cf9d69c1b312a77498a2903fc6..91dc153fa1a6effaa6c1ba2dd95d2fb13488ad2a 100644
--- a/src/Plugin/diff/Field/FileFieldBuilder.php
+++ b/src/Plugin/diff/Field/FileFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
diff --git a/src/Plugin/diff/Field/ImageFieldBuilder.php b/src/Plugin/diff/Field/ImageFieldBuilder.php
index 052b138a617a90bacbeb87949a363f1ad2051645..7a87953ea914c99596c9e0434ad426e349eab1b3 100644
--- a/src/Plugin/diff/Field/ImageFieldBuilder.php
+++ b/src/Plugin/diff/Field/ImageFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -22,7 +24,7 @@ class ImageFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
     $fileManager = $this->entityTypeManager->getStorage('file');
     // Every item from $field_items is of type FieldItemInterface.
@@ -95,7 +97,7 @@ class ImageFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['show_id'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Show image ID'),
@@ -138,7 +140,7 @@ class ImageFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['show_id'] = $form_state->getValue('show_id');
     $this->configuration['compare_alt_field'] = $form_state->getValue('compare_alt_field');
     $this->configuration['compare_title_field'] = $form_state->getValue('compare_title_field');
@@ -151,7 +153,7 @@ class ImageFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'show_id' => 0,
       'compare_alt_field' => 1,
diff --git a/src/Plugin/diff/Field/LinkFieldBuilder.php b/src/Plugin/diff/Field/LinkFieldBuilder.php
index df356db86c484a54d85b7e7360a1cd87837d6048..94292f8eb44fa489be97bfad6e1c4094814dd4d7 100644
--- a/src/Plugin/diff/Field/LinkFieldBuilder.php
+++ b/src/Plugin/diff/Field/LinkFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -22,7 +24,7 @@ class LinkFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
 
     // Every item from $field_items is of type FieldItemInterface.
@@ -50,7 +52,7 @@ class LinkFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['compare_title'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Compare link title'),
@@ -68,7 +70,7 @@ class LinkFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['compare_title'] = $form_state->getValue('compare_title');
     $this->configuration['compare_uri'] = $form_state->getValue('compare_uri');
 
@@ -78,7 +80,7 @@ class LinkFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'compare_title' => 0,
       'compare_uri' => 1,
diff --git a/src/Plugin/diff/Field/ListFieldBuilder.php b/src/Plugin/diff/Field/ListFieldBuilder.php
index fe457a12d34cdb8152bc6b0c68877493311264a8..8658e990743ea9ac31601193830387308528b334 100644
--- a/src/Plugin/diff/Field/ListFieldBuilder.php
+++ b/src/Plugin/diff/Field/ListFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -34,19 +36,11 @@ class ListFieldBuilder extends FieldDiffBuilderBase {
         $possible_options = $field_item->getPossibleOptions();
         $values = $field_item->getValue();
         if ($this->configuration['compare']) {
-          switch ($this->configuration['compare']) {
-            case 'both':
-              $result[$field_key][] = $possible_options[$values['value']] . ' (' . $values['value'] . ')';
-              break;
-
-            case 'label':
-              $result[$field_key][] = $possible_options[$values['value']];
-              break;
-
-            default:
-              $result[$field_key][] = $values['value'];
-              break;
-          }
+          $result[$field_key][] = match ($this->configuration['compare']) {
+            'both' => $possible_options[$values['value']] . ' (' . $values['value'] . ')',
+            'label' => $possible_options[$values['value']],
+            default => $values['value'],
+          };
         }
       }
     }
diff --git a/src/Plugin/diff/Field/TextFieldBuilder.php b/src/Plugin/diff/Field/TextFieldBuilder.php
index 47c7bc5ec5afe78c92c09befd342af65cb468b3e..c0d5e75c195aed897af242ed66335adaef7293e7 100644
--- a/src/Plugin/diff/Field/TextFieldBuilder.php
+++ b/src/Plugin/diff/Field/TextFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -24,7 +26,7 @@ class TextFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
     // Every item from $field_items is of type FieldItemInterface.
     foreach ($field_items as $field_key => $field_item) {
@@ -68,7 +70,7 @@ class TextFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['compare_format'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Compare format'),
@@ -82,7 +84,7 @@ class TextFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['compare_format'] = $form_state->getValue('compare_format');
 
     parent::submitConfigurationForm($form, $form_state);
@@ -91,7 +93,7 @@ class TextFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'compare_format' => 0,
     ];
diff --git a/src/Plugin/diff/Field/TextWithSummaryFieldBuilder.php b/src/Plugin/diff/Field/TextWithSummaryFieldBuilder.php
index fc3184626185fd1e4f0336d20c48b83a0fcb76a4..4a3f450f0db23d9923d22b10731ba1d0e8c5c698 100644
--- a/src/Plugin/diff/Field/TextWithSummaryFieldBuilder.php
+++ b/src/Plugin/diff/Field/TextWithSummaryFieldBuilder.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -22,7 +24,7 @@ class TextWithSummaryFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
     // Every item from $field_items is of type FieldItemInterface.
     foreach ($field_items as $field_key => $field_item) {
@@ -78,7 +80,7 @@ class TextWithSummaryFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
     $form['compare_format'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Compare format'),
@@ -98,7 +100,7 @@ class TextWithSummaryFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+  public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
     $this->configuration['compare_format'] = $form_state->getValue('compare_format');
     $this->configuration['compare_summary'] = $form_state->getValue('compare_summary');
 
@@ -108,7 +110,7 @@ class TextWithSummaryFieldBuilder extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function defaultConfiguration() {
+  public function defaultConfiguration(): array {
     $default_configuration = [
       'compare_format' => 0,
       'compare_summary' => 0,
diff --git a/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
index 5aa189c8815af073746b4d5296276939c58015df..f4fe4a9f87edbe8b3324d3c023c53e30a77b8fe6 100644
--- a/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
+++ b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Layout;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
@@ -24,50 +26,8 @@ use Symfony\Component\HttpFoundation\RequestStack;
  */
 class SplitFieldsDiffLayout extends DiffLayoutBase {
 
-  /**
-   * The renderer.
-   *
-   * @var \Drupal\Core\Render\RendererInterface
-   */
-  protected $renderer;
-
-  /**
-   * The diff entity comparison service.
-   *
-   * @var \Drupal\diff\DiffEntityComparison
-   */
-  protected $entityComparison;
-
-  /**
-   * The request stack.
-   *
-   * @var \Symfony\Component\HttpFoundation\RequestStack
-   */
-  protected $requestStack;
-
   /**
    * Constructs a SplitFieldsDiffLayout object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
-   *   The configuration factory object.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\Core\Datetime\DateFormatterInterface $date
-   *   The date service.
-   * @param \Drupal\Core\Render\RendererInterface $renderer
-   *   The renderer.
-   * @param \Drupal\diff\DiffEntityComparison $entity_comparison
-   *   The diff entity comparison service.
-   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
-   *   The request stack.
    */
   public function __construct(
     array $configuration,
@@ -77,14 +37,11 @@ class SplitFieldsDiffLayout extends DiffLayoutBase {
     EntityTypeManagerInterface $entity_type_manager,
     DiffEntityParser $entity_parser,
     DateFormatterInterface $date,
-    RendererInterface $renderer,
-    DiffEntityComparison $entity_comparison,
-    RequestStack $request_stack,
+    protected RendererInterface $renderer,
+    protected DiffEntityComparison $entityComparison,
+    protected RequestStack $requestStack,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $config, $entity_type_manager, $entity_parser, $date);
-    $this->renderer = $renderer;
-    $this->entityComparison = $entity_comparison;
-    $this->requestStack = $request_stack;
   }
 
   /**
@@ -108,7 +65,7 @@ class SplitFieldsDiffLayout extends DiffLayoutBase {
   /**
    * {@inheritdoc}
    */
-  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity) {
+  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity): array {
     // Build the revisions data.
     $build = $this->buildRevisionsData($left_revision, $right_revision);
 
@@ -275,7 +232,7 @@ class SplitFieldsDiffLayout extends DiffLayoutBase {
    * @return array
    *   Header for Diff table.
    */
-  protected function buildTableHeader(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision) {
+  protected function buildTableHeader(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision): array {
     $header = [];
     $header[] = [
       'data' => ['#markup' => $this->buildRevisionLink($left_revision)],
diff --git a/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
index c0ccb6481bc32dbf0155fcc8b0fb3e2aa930543e..521124257bb7ce77c6f460acbfdb4fbf9ec6120a 100644
--- a/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
+++ b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Layout;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
@@ -25,50 +27,8 @@ use Symfony\Component\HttpFoundation\RequestStack;
  */
 class UnifiedFieldsDiffLayout extends DiffLayoutBase {
 
-  /**
-   * The renderer.
-   *
-   * @var \Drupal\Core\Render\RendererInterface
-   */
-  protected $renderer;
-
-  /**
-   * The diff entity comparison service.
-   *
-   * @var \Drupal\diff\DiffEntityComparison
-   */
-  protected $entityComparison;
-
-  /**
-   * The request stack.
-   *
-   * @var \Symfony\Component\HttpFoundation\RequestStack
-   */
-  protected $requestStack;
-
   /**
    * Constructs a UnifiedFieldsDiffLayout object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
-   *   The configuration factory object.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\Core\Datetime\DateFormatterInterface $date
-   *   The date service.
-   * @param \Drupal\Core\Render\RendererInterface $renderer
-   *   The renderer.
-   * @param \Drupal\diff\DiffEntityComparison $entity_comparison
-   *   The diff entity comparison service.
-   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
-   *   The request stack.
    */
   public function __construct(
     array $configuration,
@@ -78,14 +38,11 @@ class UnifiedFieldsDiffLayout extends DiffLayoutBase {
     EntityTypeManagerInterface $entity_type_manager,
     DiffEntityParser $entity_parser,
     DateFormatterInterface $date,
-    RendererInterface $renderer,
-    DiffEntityComparison $entity_comparison,
-    RequestStack $request_stack,
+    protected RendererInterface $renderer,
+    protected DiffEntityComparison $entityComparison,
+    protected RequestStack $requestStack,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $config, $entity_type_manager, $entity_parser, $date);
-    $this->renderer = $renderer;
-    $this->entityComparison = $entity_comparison;
-    $this->requestStack = $request_stack;
   }
 
   /**
@@ -109,7 +66,7 @@ class UnifiedFieldsDiffLayout extends DiffLayoutBase {
   /**
    * {@inheritdoc}
    */
-  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity) {
+  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity): array {
     // Build the revisions data.
     $build = $this->buildRevisionsData($left_revision, $right_revision);
 
@@ -265,7 +222,7 @@ class UnifiedFieldsDiffLayout extends DiffLayoutBase {
    * @return array
    *   Header for Diff table.
    */
-  protected function buildTableHeader(EntityInterface $right_revision) {
+  protected function buildTableHeader(EntityInterface $right_revision): array {
     $header = [];
     $header[] = [
       'data' => ['#markup' => $this->buildRevisionLink($right_revision)],
diff --git a/src/Plugin/diff/Layout/VisualInlineDiffLayout.php b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
index bdd13ad78f7c82cc75b969fe5606df99fd96c25f..91eceb0952fdc2c29f30e8fc6a55cf91594174e8 100644
--- a/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
+++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\diff\Layout;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
@@ -27,20 +29,6 @@ use Symfony\Component\HttpFoundation\RequestStack;
  */
 class VisualInlineDiffLayout extends DiffLayoutBase {
 
-  /**
-   * The renderer.
-   *
-   * @var \Drupal\Core\Render\RendererInterface
-   */
-  protected $renderer;
-
-  /**
-   * The diff entity comparison service.
-   *
-   * @var \Drupal\diff\DiffEntityComparison
-   */
-  protected $entityComparison;
-
   /**
    * The html diff service.
    *
@@ -48,47 +36,8 @@ class VisualInlineDiffLayout extends DiffLayoutBase {
    */
   protected $htmlDiff;
 
-  /**
-   * The request stack.
-   *
-   * @var \Symfony\Component\HttpFoundation\RequestStack
-   */
-  protected $requestStack;
-
-  /**
-   * The entity display repository.
-   *
-   * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
-   */
-  protected $entityDisplayRepository;
-
   /**
    * Constructs a VisualInlineDiffLayout object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config
-   *   The configuration factory object.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
-   * @param \Drupal\diff\DiffEntityParser $entity_parser
-   *   The entity parser.
-   * @param \Drupal\Core\Datetime\DateFormatterInterface $date
-   *   The date service.
-   * @param \Drupal\Core\Render\RendererInterface $renderer
-   *   The renderer.
-   * @param \Drupal\diff\DiffEntityComparison $entity_comparison
-   *   The diff entity comparison service.
-   * @param \HtmlDiffAdvancedInterface $html_diff
-   *   The html diff service.
-   * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
-   *   The request stack.
-   * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
-   *   The entity display repository.
    */
   public function __construct(
     array $configuration,
@@ -98,23 +47,19 @@ class VisualInlineDiffLayout extends DiffLayoutBase {
     EntityTypeManagerInterface $entity_type_manager,
     DiffEntityParser $entity_parser,
     DateFormatterInterface $date,
-    RendererInterface $renderer,
-    DiffEntityComparison $entity_comparison,
+    protected RendererInterface $renderer,
+    protected DiffEntityComparison $entityComparison,
     \HtmlDiffAdvancedInterface $html_diff,
-    RequestStack $request_stack,
-    EntityDisplayRepositoryInterface $entity_display_repository,
+    protected RequestStack $requestStack,
+    protected EntityDisplayRepositoryInterface $entityDisplayRepository,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $config, $entity_type_manager, $entity_parser, $date);
-    $this->renderer = $renderer;
-    $this->entityComparison = $entity_comparison;
     $storage = PhpStorageFactory::get('html_purifier_serializer');
     if (!$storage->exists('cache.php')) {
       $storage->save('cache.php', 'dummy');
     }
     $html_diff->getConfig()->setPurifierCacheLocation(dirname($storage->getFullPath('cache.php')));
     $this->htmlDiff = $html_diff;
-    $this->requestStack = $request_stack;
-    $this->entityDisplayRepository = $entity_display_repository;
   }
 
   /**
@@ -140,7 +85,7 @@ class VisualInlineDiffLayout extends DiffLayoutBase {
   /**
    * {@inheritdoc}
    */
-  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity) {
+  public function build(ContentEntityInterface $left_revision, ContentEntityInterface $right_revision, ContentEntityInterface $entity): array {
     // Build the revisions data.
     $build = $this->buildRevisionsData($left_revision, $right_revision);
 
diff --git a/src/Plugin/views/field/DiffFrom.php b/src/Plugin/views/field/DiffFrom.php
index 6b0eff4d2cec7fff111f380e04f09c5d2c467f56..7c2fab7d669fa1c39d0c2e783a29b00a4227ff44 100644
--- a/src/Plugin/views/field/DiffFrom.php
+++ b/src/Plugin/views/field/DiffFrom.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\views\field;
 
 use Drupal\Core\Entity\RevisionableInterface;
@@ -21,8 +23,7 @@ class DiffFrom extends DiffPluginBase {
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
-
-    $options['label']['default'] = t('From');
+    $options['label']['default'] = $this->t('From');
     return $options;
   }
 
@@ -41,12 +42,13 @@ class DiffFrom extends DiffPluginBase {
    * @return string|null
    *   The diff_to field ID, or null if the field was not found on the view.
    */
-  protected function getToFieldId() {
+  protected function getToFieldId(): ?string {
     foreach ($this->view->field as $id => $field) {
       if ($field instanceof DiffTo) {
         return $id;
       }
     }
+    return NULL;
   }
 
   /**
@@ -60,7 +62,7 @@ class DiffFrom extends DiffPluginBase {
    * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    *   Thrown when the user tried to access an action without access to it.
    */
-  public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
+  public function viewsFormSubmit(array &$form, FormStateInterface $form_state): void {
     if ($form_state->get('step') == 'views_form_views_form') {
       $diff_from = $form_state->getValue($this->options['id']);
       $diff_from_entity = $this->loadEntityFromDiffFormKey($diff_from);
diff --git a/src/Plugin/views/field/DiffPluginBase.php b/src/Plugin/views/field/DiffPluginBase.php
index d207e68be4c1ceb41db1b2c6cf9a46e18466d0bb..74d54dd6aa84b1f42982e6050835cd89470b7866 100644
--- a/src/Plugin/views/field/DiffPluginBase.php
+++ b/src/Plugin/views/field/DiffPluginBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\views\field;
 
 use Drupal\Component\Serialization\Json;
@@ -7,6 +9,7 @@ use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Entity\RevisionableInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Core\TypedData\TranslatableInterface;
 use Drupal\views\Plugin\views\field\FieldPluginBase;
 use Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait;
@@ -20,34 +23,18 @@ class DiffPluginBase extends FieldPluginBase {
 
   use UncacheableFieldHandlerTrait;
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   */
-  protected $entityTypeManager;
-
   /**
    * Constructs a DiffPluginBase object.
-   *
-   * @param array $configuration
-   *   A configuration array containing information about the plugin instance.
-   * @param string $plugin_id
-   *   The plugin ID for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
    */
   public function __construct(
     array $configuration,
     $plugin_id,
     $plugin_definition,
-    EntityTypeManagerInterface $entity_type_manager,
+    protected EntityTypeManagerInterface $entityTypeManager,
+    TranslationInterface $translation,
   ) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
-
-    $this->entityTypeManager = $entity_type_manager;
+    $this->setStringTranslation($translation);
   }
 
   /**
@@ -59,6 +46,7 @@ class DiffPluginBase extends FieldPluginBase {
       $plugin_id,
       $plugin_definition,
       $container->get('entity_type.manager'),
+      $container->get('string_translation'),
     );
   }
 
@@ -111,7 +99,7 @@ class DiffPluginBase extends FieldPluginBase {
    *
    * @see self::loadEntityFromDiffFormKey()
    */
-  protected function calculateEntityDiffFormKey(EntityInterface $entity) {
+  protected function calculateEntityDiffFormKey(EntityInterface $entity): string {
     $key_parts = [$entity->language()->getId(), $entity->id()];
 
     if ($entity instanceof RevisionableInterface) {
@@ -139,7 +127,7 @@ class DiffPluginBase extends FieldPluginBase {
    * @throws \UnexpectedValueException
    *   If no entity can be found for the given diff form key.
    */
-  protected function loadEntityFromDiffFormKey($diff_form_key) {
+  protected function loadEntityFromDiffFormKey($diff_form_key): EntityInterface {
     $key = base64_decode($diff_form_key);
     $key_parts = Json::decode($key);
     $revision_id = NULL;
diff --git a/src/Plugin/views/field/DiffTo.php b/src/Plugin/views/field/DiffTo.php
index 3e6b9597526156658a63d899a80c29d60d2c8656..261fcb34dc16fb2405328fef2db94f55fc486c78 100644
--- a/src/Plugin/views/field/DiffTo.php
+++ b/src/Plugin/views/field/DiffTo.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Plugin\views\field;
 
 /**
@@ -14,8 +16,7 @@ class DiffTo extends DiffPluginBase {
    */
   protected function defineOptions() {
     $options = parent::defineOptions();
-
-    $options['label']['default'] = t('To');
+    $options['label']['default'] = $this->t('To');
     return $options;
   }
 
diff --git a/src/Routing/DiffRouteProvider.php b/src/Routing/DiffRouteProvider.php
index ebc4f1ec20e34e6dbf9eaaf0f1f6fd60aa326b2a..86d3f5b92508f356a4aea5a9f985c650ae50fd34 100644
--- a/src/Routing/DiffRouteProvider.php
+++ b/src/Routing/DiffRouteProvider.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Routing;
 
 use Drupal\Core\Entity\EntityTypeInterface;
@@ -32,7 +34,7 @@ class DiffRouteProvider implements EntityRouteProviderInterface {
    * @return \Symfony\Component\Routing\Route|null
    *   The diff route.
    */
-  protected function getDiffRoute(EntityTypeInterface $entity_type) {
+  protected function getDiffRoute(EntityTypeInterface $entity_type): ?Route {
     if ($entity_type->hasLinkTemplate('revisions-diff')) {
       $route = new Route($entity_type->getLinkTemplate('revisions-diff'));
       $route->addDefaults([
@@ -49,6 +51,7 @@ class DiffRouteProvider implements EntityRouteProviderInterface {
       ]);
       return $route;
     }
+    return NULL;
   }
 
 }
diff --git a/src/Routing/RouteSubscriber.php b/src/Routing/RouteSubscriber.php
index 9ef4af7f852b462867a1502a6bc19f6ab7f0abe9..d7480b59cb251f01f28fbaa139f185b1519522bd 100755
--- a/src/Routing/RouteSubscriber.php
+++ b/src/Routing/RouteSubscriber.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff\Routing;
 
 use Drupal\Core\Routing\RouteSubscriberBase;
diff --git a/src/VisualDiffThemeNegotiator.php b/src/VisualDiffThemeNegotiator.php
index e5678c478a1bdf481d6f309c917e65ccd4d52fd0..a3e333116fcb42d209206a8a688cdcfe81ee2e0b 100644
--- a/src/VisualDiffThemeNegotiator.php
+++ b/src/VisualDiffThemeNegotiator.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
@@ -13,22 +15,12 @@ use Drupal\Core\Theme\ThemeNegotiatorInterface;
  */
 class VisualDiffThemeNegotiator implements ThemeNegotiatorInterface {
 
-  /**
-   * The config factory.
-   *
-   * @var \Drupal\Core\Config\ConfigFactoryInterface
-   */
-  protected $configFactory;
-
   /**
    * VisualDiffThemeNegotiator constructor.
-   *
-   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
-   *   The config factory.
    */
-  public function __construct(ConfigFactoryInterface $config_factory) {
-    $this->configFactory = $config_factory;
-  }
+  public function __construct(
+    protected ConfigFactoryInterface $configFactory,
+  ) {}
 
   /**
    * {@inheritdoc}
@@ -65,10 +57,10 @@ class VisualDiffThemeNegotiator implements ThemeNegotiatorInterface {
    * @return bool
    *   Return TRUE if route name is ok.
    */
-  protected function isDiffRoute(RouteMatchInterface $route_match) {
+  protected function isDiffRoute(RouteMatchInterface $route_match): bool {
     $regex_pattern = '/^entity\..*\.revisions_diff$/';
     return $route_match->getRouteName() === 'diff.revisions_diff' ||
-      preg_match($regex_pattern, $route_match->getRouteName());
+      preg_match($regex_pattern, (string) $route_match->getRouteName());
   }
 
 }
diff --git a/tests/modules/diff_test/src/Plugin/diff/Field/TestHeavierTextPlugin.php b/tests/modules/diff_test/src/Plugin/diff/Field/TestHeavierTextPlugin.php
index 9ec086dd19d37d54f3ee76e88d3f97942a50dcba..9aa3ddaeef1ff377b50d6657302c8d7cb04b5bd9 100644
--- a/tests/modules/diff_test/src/Plugin/diff/Field/TestHeavierTextPlugin.php
+++ b/tests/modules/diff_test/src/Plugin/diff/Field/TestHeavierTextPlugin.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff_test\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -23,7 +25,7 @@ class TestHeavierTextPlugin extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
 
     // Every item from $field_items is of type FieldItemInterface.
@@ -31,7 +33,7 @@ class TestHeavierTextPlugin extends FieldDiffBuilderBase {
       if (!$field_item->isEmpty()) {
         $values = $field_item->getValue();
         if (isset($values['value'])) {
-          $result[$field_key][] = str_replace('applicable', 'heavier_test_plugin', $values['value']);
+          $result[$field_key][] = str_replace('applicable', 'heavier_test_plugin', (string) $values['value']);
         }
       }
     }
@@ -41,7 +43,7 @@ class TestHeavierTextPlugin extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public static function isApplicable(FieldStorageDefinitionInterface $field_definition) {
+  public static function isApplicable(FieldStorageDefinitionInterface $field_definition): bool {
     return ($field_definition->getName() == 'test_field' || $field_definition->getName() == 'test_field_lighter');
   }
 
diff --git a/tests/modules/diff_test/src/Plugin/diff/Field/TestLighterTextPlugin.php b/tests/modules/diff_test/src/Plugin/diff/Field/TestLighterTextPlugin.php
index b6b4aeb8412e575ca727495116968b349ab58c13..c99fb529b92969a93d95374301d9eb94eb8f71aa 100644
--- a/tests/modules/diff_test/src/Plugin/diff/Field/TestLighterTextPlugin.php
+++ b/tests/modules/diff_test/src/Plugin/diff/Field/TestLighterTextPlugin.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\diff_test\Plugin\diff\Field;
 
 use Drupal\Core\Field\FieldItemListInterface;
@@ -23,7 +25,7 @@ class TestLighterTextPlugin extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public function build(FieldItemListInterface $field_items) {
+  public function build(FieldItemListInterface $field_items): array {
     $result = [];
 
     // Every item from $field_items is of type FieldItemInterface.
@@ -31,7 +33,7 @@ class TestLighterTextPlugin extends FieldDiffBuilderBase {
       if (!$field_item->isEmpty()) {
         $values = $field_item->getValue();
         if (isset($values['value'])) {
-          $result[$field_key][] = str_replace('applicable', 'lighter_test_plugin', $values['value']);
+          $result[$field_key][] = str_replace('applicable', 'lighter_test_plugin', (string) $values['value']);
         }
       }
     }
@@ -41,7 +43,7 @@ class TestLighterTextPlugin extends FieldDiffBuilderBase {
   /**
    * {@inheritdoc}
    */
-  public static function isApplicable(FieldStorageDefinitionInterface $field_definition) {
+  public static function isApplicable(FieldStorageDefinitionInterface $field_definition): bool {
     return ($field_definition->getName() == 'test_field_lighter');
   }
 
diff --git a/tests/src/Functional/CoreVersionUiTestTrait.php b/tests/src/Functional/CoreVersionUiTestTrait.php
index d56bc032de032ebd43b99ddff5276bd31d6a02f2..1bd010407ff14f67c51a1b409c662e348cdc484f 100644
--- a/tests/src/Functional/CoreVersionUiTestTrait.php
+++ b/tests/src/Functional/CoreVersionUiTestTrait.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 /**
diff --git a/tests/src/Functional/DiffAdminFormsTest.php b/tests/src/Functional/DiffAdminFormsTest.php
index e76b9729106aaa4ccb5a1b58a817ffde2bb3ba18..ab9b02b042fe90229bc2689d3ce65b14fa3c1789 100644
--- a/tests/src/Functional/DiffAdminFormsTest.php
+++ b/tests/src/Functional/DiffAdminFormsTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 /**
@@ -165,7 +167,7 @@ class DiffAdminFormsTest extends DiffTestBase {
     $this->assertSession()->linkExists('Raw');
     $this->assertSession()->linkExists('Strip tags');
     $text = $this->xpath('//tbody/tr[4]/td[3]');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($text[0]->getHtml())), '<p>great_body</p>');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $text[0]->getHtml())), '<p>great_body</p>');
 
     // Change the settings of the layouts, disable the single column.
     $edit = [
diff --git a/tests/src/Functional/DiffControllerTest.php b/tests/src/Functional/DiffControllerTest.php
index fae10286a052e1086da95d9ba11571d268eeaabb..8383e4f1188de80a116286831e3159c305a66973 100644
--- a/tests/src/Functional/DiffControllerTest.php
+++ b/tests/src/Functional/DiffControllerTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Core\Url;
diff --git a/tests/src/Functional/DiffPluginEntityTest.php b/tests/src/Functional/DiffPluginEntityTest.php
index cb53d83e08c02458ca05dd2b3cd6d7be16682a0d..54f8230b449806e5ef94fe695ec3f894ebc0192c 100644
--- a/tests/src/Functional/DiffPluginEntityTest.php
+++ b/tests/src/Functional/DiffPluginEntityTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
diff --git a/tests/src/Functional/DiffPluginFileTest.php b/tests/src/Functional/DiffPluginFileTest.php
index bbdc1bc5ad26d08a8201f5440d49ae2b8ea919e9..40f40b4ef0cbcdc431b09bbe1834275543a45a3c 100644
--- a/tests/src/Functional/DiffPluginFileTest.php
+++ b/tests/src/Functional/DiffPluginFileTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\field\Entity\FieldConfig;
diff --git a/tests/src/Functional/DiffPluginTest.php b/tests/src/Functional/DiffPluginTest.php
index fd370ce5eb2e7b7b8683dd65ebccf7ced7dab76f..d707b9fc845b1dad90badd7c45ac0a3711b25ff4 100644
--- a/tests/src/Functional/DiffPluginTest.php
+++ b/tests/src/Functional/DiffPluginTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\comment\Tests\CommentTestTrait;
@@ -194,7 +196,7 @@ class DiffPluginTest extends DiffPluginTestBase {
     $rows = $this->xpath('//tbody/tr');
     $diff_row = $rows[1]->findAll('xpath', '/td');
     $this->assertCount(3, $rows);
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($diff_row[2]->getHtml())), '<p>body</p>');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $diff_row[2]->getHtml())), '<p>body</p>');
 
     // Create a new revision and update the body.
     $edit = [
@@ -214,9 +216,9 @@ class DiffPluginTest extends DiffPluginTestBase {
     // multiple rows show and all of them, including empty lines, display line
     // numbers.
     $this->assertGreaterThan(3, count($rows));
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($rows[1]->findAll('xpath', '/td')[3]->getHtml())), '1');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($rows[2]->findAll('xpath', '/td')[3]->getHtml())), '2');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($rows[3]->findAll('xpath', '/td')[3]->getHtml())), '3');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $rows[1]->findAll('xpath', '/td')[3]->getHtml())), '1');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $rows[2]->findAll('xpath', '/td')[3]->getHtml())), '2');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $rows[3]->findAll('xpath', '/td')[3]->getHtml())), '3');
   }
 
 }
diff --git a/tests/src/Functional/DiffPluginTestBase.php b/tests/src/Functional/DiffPluginTestBase.php
index f00be81a1f99dc6b8bb62826d6f9e39518d26984..77d2588e5bf9a5c98ebdbc5beae2ee660bb5efde 100644
--- a/tests/src/Functional/DiffPluginTestBase.php
+++ b/tests/src/Functional/DiffPluginTestBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Tests\TestFileCreationTrait;
diff --git a/tests/src/Functional/DiffPluginVariousTest.php b/tests/src/Functional/DiffPluginVariousTest.php
index 942138042a87f8d3b3b59b7e9763472dda021467..109c1b07dd117f08d25c289854542e08df6d903e 100644
--- a/tests/src/Functional/DiffPluginVariousTest.php
+++ b/tests/src/Functional/DiffPluginVariousTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
@@ -189,7 +191,7 @@ class DiffPluginVariousTest extends DiffPluginTestBase {
     // Create a new revision with an updated timestamp.
     /** @var \Drupal\node\NodeInterface $node */
     $node = $this->drupalGetNodeByTitle('timestamp_test');
-    $node->field_timestamp = $new_timestamp;
+    $node->set('field_timestamp', $new_timestamp);
     $node->setNewRevision(TRUE);
     $node->save();
 
diff --git a/tests/src/Functional/DiffRevisionContentModerationTest.php b/tests/src/Functional/DiffRevisionContentModerationTest.php
index 355ab0a8afb5bc4fd8104be2d634e14727f4c9d5..1c78ac5107e7f1ded4c7fe4ede5994c2d6201bf9 100644
--- a/tests/src/Functional/DiffRevisionContentModerationTest.php
+++ b/tests/src/Functional/DiffRevisionContentModerationTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
diff --git a/tests/src/Functional/DiffRevisionTest.php b/tests/src/Functional/DiffRevisionTest.php
index 53e65b9ffdcc60d3e6da89428aa6869a5e565683..e5d5276bc085b4cb14458c374114d87fe3896a97 100644
--- a/tests/src/Functional/DiffRevisionTest.php
+++ b/tests/src/Functional/DiffRevisionTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\language\Entity\ConfigurableLanguage;
@@ -99,11 +101,11 @@ class DiffRevisionTest extends DiffTestBase {
     $this->assertEquals($diff_row[0]->getText(), '1');
     $this->assertEquals($diff_row[1]->getText(), '-');
     $this->assertEquals($diff_row[2]->find('xpath', 'span')->getText(), '1');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($diff_row[2]->getHtml())), '<p>Revision 1</p>');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $diff_row[2]->getHtml())), '<p>Revision 1</p>');
     $this->assertEquals($diff_row[3]->getText(), '1');
     $this->assertEquals($diff_row[4]->getText(), '+');
     $this->assertEquals($diff_row[5]->find('xpath', 'span')->getText(), '2');
-    $this->assertEquals(htmlspecialchars_decode((strip_tags($diff_row[5]->getHtml()))), '<p>Revision 2</p>');
+    $this->assertEquals(htmlspecialchars_decode((strip_tags((string) $diff_row[5]->getHtml()))), '<p>Revision 2</p>');
 
     // Compare the revisions in markdown mode.
     $this->clickLink('Strip tags');
@@ -120,10 +122,10 @@ class DiffRevisionTest extends DiffTestBase {
     // Assert changes made to the body, text 1 changed to 2.
     $this->assertEquals($diff_row[0]->getText(), '-');
     $this->assertEquals($diff_row[1]->find('xpath', 'span')->getText(), '1');
-    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags($diff_row[1]->getHtml()))), 'Revision 1');
+    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags((string) $diff_row[1]->getHtml()))), 'Revision 1');
     $this->assertEquals($diff_row[2]->getText(), '+');
     $this->assertEquals($diff_row[3]->find('xpath', 'span')->getText(), '2');
-    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags($diff_row[3]->getHtml()))), 'Revision 2');
+    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags((string) $diff_row[3]->getHtml()))), 'Revision 2');
 
     // Compare the revisions in single column mode.
     $this->clickLink('Unified fields');
@@ -142,13 +144,13 @@ class DiffRevisionTest extends DiffTestBase {
     $this->assertEquals($diff_row[1]->getText(), '');
     $this->assertEquals($diff_row[2]->getText(), '-');
     $this->assertEquals($diff_row[3]->find('xpath', 'span')->getText(), '1');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($diff_row[3]->getHtml())), '<p>Revision 1</p>');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $diff_row[3]->getHtml())), '<p>Revision 1</p>');
     $diff_row = $rows[2]->findAll('xpath', '/td');
     $this->assertEquals($diff_row[0]->getText(), '');
     $this->assertEquals($diff_row[1]->getText(), '1');
     $this->assertEquals($diff_row[2]->getText(), '+');
     $this->assertEquals($diff_row[3]->find('xpath', 'span')->getText(), '2');
-    $this->assertEquals(htmlspecialchars_decode(strip_tags($diff_row[3]->getHtml())), '<p>Revision 2</p>');
+    $this->assertEquals(htmlspecialchars_decode(strip_tags((string) $diff_row[3]->getHtml())), '<p>Revision 2</p>');
     $this->assertSession()->pageTextContainsOnce('first_unique_text');
     $this->assertSession()->pageTextContainsOnce('second_unique_text');
     $diff_row = $rows[3]->findAll('xpath', '/td');
@@ -167,11 +169,11 @@ class DiffRevisionTest extends DiffTestBase {
     // there are no line numbers.
     $this->assertEquals($diff_row[0]->getText(), '-');
     $this->assertEquals($diff_row[1]->find('xpath', 'span')->getText(), '1');
-    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags($diff_row[1]->getHtml()))), 'Revision 1');
+    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags((string) $diff_row[1]->getHtml()))), 'Revision 1');
     $diff_row = $rows[2]->findAll('xpath', '/td');
     $this->assertEquals($diff_row[0]->getText(), '+');
     $this->assertEquals($diff_row[1]->find('xpath', 'span')->getText(), '2');
-    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags($diff_row[1]->getHtml()))), 'Revision 2');
+    $this->assertEquals(htmlspecialchars_decode(trim(strip_tags((string) $diff_row[1]->getHtml()))), 'Revision 2');
 
     $this->drupalGet('node/' . $node->id());
     $this->clickLink(t('Revisions'));
@@ -236,7 +238,7 @@ class DiffRevisionTest extends DiffTestBase {
     $this->clickLink('Revisions');
     // Assert the revision summary.
     $page_text = $this->getSession()->getPage()->getText();
-    $nr_found = substr_count($page_text, 'this revision message will appear twice');
+    $nr_found = substr_count((string) $page_text, 'this revision message will appear twice');
     $this->assertGreaterThan(1, $nr_found, "'this revision message will appear twice' found more than once on the page");
     $this->assertSession()->pageTextContains('Copy of the revision from');
     $edit = [
diff --git a/tests/src/Functional/DiffTestBase.php b/tests/src/Functional/DiffTestBase.php
index d46afd6972e142a39175621c0f909d8b90ee8cdf..5c3ad38e08fb404967d33c6c0329c719ffc65903 100644
--- a/tests/src/Functional/DiffTestBase.php
+++ b/tests/src/Functional/DiffTestBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Tests\BrowserTestBase;
diff --git a/tests/src/Functional/DiffViewModeTest.php b/tests/src/Functional/DiffViewModeTest.php
index 279171549c57278a2f25a0d8492675114cfc007a..140ff3532466c2f8747d1c2dfb2aa9cbeb3227e8 100644
--- a/tests/src/Functional/DiffViewModeTest.php
+++ b/tests/src/Functional/DiffViewModeTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 /**
diff --git a/tests/src/Functional/DiffViewsTest.php b/tests/src/Functional/DiffViewsTest.php
index 24946ae0e40dadfc955b81f831bc6f3637f8ece9..803b8a8872c73727c747d2618d645067b2ba564a 100644
--- a/tests/src/Functional/DiffViewsTest.php
+++ b/tests/src/Functional/DiffViewsTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Core\Url;
diff --git a/tests/src/Functional/NodeAccessTest.php b/tests/src/Functional/NodeAccessTest.php
index fe281f8d253b695e789c2c019486339aa8a8c751..17e03751682bd09fef74dc0e1543a871c204e1d0 100644
--- a/tests/src/Functional/NodeAccessTest.php
+++ b/tests/src/Functional/NodeAccessTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Functional;
 
 use Drupal\Tests\BrowserTestBase;
diff --git a/tests/src/FunctionalJavascript/DiffLocaleTest.php b/tests/src/FunctionalJavascript/DiffLocaleTest.php
index e6c2aec2c8d5c1594ab793a184234854f75c56e4..a50499b1af1b3d33eef383d1125f97b27d3b940e 100644
--- a/tests/src/FunctionalJavascript/DiffLocaleTest.php
+++ b/tests/src/FunctionalJavascript/DiffLocaleTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\FunctionalJavascript;
 
 use Drupal\Tests\diff\Functional\CoreVersionUiTestTrait;
diff --git a/tests/src/FunctionalJavascript/DiffTestBase.php b/tests/src/FunctionalJavascript/DiffTestBase.php
index 46c286fbeb65d6d209b03d122aed8685bed7b512..521804602e0ab0dbb5694d8fb36eae3f7c402b7a 100644
--- a/tests/src/FunctionalJavascript/DiffTestBase.php
+++ b/tests/src/FunctionalJavascript/DiffTestBase.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\FunctionalJavascript;
 
 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
diff --git a/tests/src/Unit/VisualDiffThemeNegotiatorTest.php b/tests/src/Unit/VisualDiffThemeNegotiatorTest.php
index 05af78fbfea7511fb01aa23fb7c042a5ada0a2e3..6b32a35154849ffa20fd463f5f04833a38641753 100644
--- a/tests/src/Unit/VisualDiffThemeNegotiatorTest.php
+++ b/tests/src/Unit/VisualDiffThemeNegotiatorTest.php
@@ -1,5 +1,7 @@
 <?php
 
+declare(strict_types=1);
+
 namespace Drupal\Tests\diff\Unit;
 
 use Drupal\Core\Config\ConfigFactoryInterface;