From 83aeb1705d1a87ab1b266cab01ef107212cd2a49 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 06:53:58 -0500
Subject: [PATCH 01/15] Drop support for Drupal 8 and 9.

---
 entity_reference_integrity.info.yml                             | 2 +-
 .../entity_reference_integrity_enforce.info.yml                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/entity_reference_integrity.info.yml b/entity_reference_integrity.info.yml
index 39b89c8..2430758 100644
--- a/entity_reference_integrity.info.yml
+++ b/entity_reference_integrity.info.yml
@@ -1,6 +1,6 @@
 name: Entity Reference Integrity
 description: Protect entities from being deleted if they are the target of an entity reference field.
-core_version_requirement: ^8.8 || ^9 || ^10
+core_version_requirement: ^10
 type: module
 
 package: Entity Reference Integrity
diff --git a/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml b/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
index ce81670..151cd88 100644
--- a/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
+++ b/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
@@ -1,7 +1,7 @@
 name: Entity Reference Integrity Enforce
 description: Enforce reference integrity on entities.
 package: Entity Reference Integrity
-core_version_requirement: ^8.8 || ^9 || ^10
+core_version_requirement: ^10
 type: module
 
 dependencies:
-- 
GitLab


From f6012f1af73685cdc502fd737e51991ec7f93d53 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 06:54:53 -0500
Subject: [PATCH 02/15] Issue #3380250 by broon, tim-diels, m.stenta: Call to
 deprecated method getImplementations()

---
 .../src/Kernel/EntityPredeleteHookTest.php    | 22 ++++++++-----------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/modules/entity_reference_integrity_enforce/tests/src/Kernel/EntityPredeleteHookTest.php b/modules/entity_reference_integrity_enforce/tests/src/Kernel/EntityPredeleteHookTest.php
index 4c237c3..b9590eb 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Kernel/EntityPredeleteHookTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Kernel/EntityPredeleteHookTest.php
@@ -23,22 +23,18 @@ class EntityPredeleteHookTest extends KernelTestBase {
 
   /**
    * Test the entity_predelete implementations.
-   *
-   * @requires function \Drupal\Core\Extension\ModuleHandlerInterface::hasImplementations
    */
   public function testHook() {
-    $this->assertTrue(\Drupal::moduleHandler()->hasImplementations('entity_predelete', 'entity_reference_integrity_enforce'));
-  }
 
-  /**
-   * Test the weight of entity_predelete implementations.
-   *
-   * @legacy
-   * @requires function \Drupal\Core\Extension\ModuleHandlerInterface::getImplementations
-   */
-  public function testHookWeightLegacy() {
-    $implementations = \Drupal::moduleHandler()->getImplementations('entity_predelete');
-    $this->assertEquals('entity_reference_integrity_enforce', array_shift($implementations));
+    // Get a list of all implementors of hook_entity_predelete().
+    $implementors = [];
+    \Drupal::moduleHandler()->invokeAllWith('entity_predelete', function (callable $hook, string $module) use (&$implementors) {
+      $implementors[] = $module;
+    });
+
+    // Confirm that our hook is the first in the list, and comment is second.
+    $this->assertEquals('entity_reference_integrity_enforce', reset($implementors));
+    $this->assertEquals('comment', next($implementors));
   }
 
 }
-- 
GitLab


From a9e9b82d4827b7855deec87e2ca403ba7133ef6a Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 11:03:59 -0500
Subject: [PATCH 03/15] Require Drupal ^10.2.

---
 entity_reference_integrity.info.yml                             | 2 +-
 .../entity_reference_integrity_enforce.info.yml                 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/entity_reference_integrity.info.yml b/entity_reference_integrity.info.yml
index 2430758..599bc24 100644
--- a/entity_reference_integrity.info.yml
+++ b/entity_reference_integrity.info.yml
@@ -1,6 +1,6 @@
 name: Entity Reference Integrity
 description: Protect entities from being deleted if they are the target of an entity reference field.
-core_version_requirement: ^10
+core_version_requirement: ^10.2
 type: module
 
 package: Entity Reference Integrity
diff --git a/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml b/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
index 151cd88..0695757 100644
--- a/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
+++ b/modules/entity_reference_integrity_enforce/entity_reference_integrity_enforce.info.yml
@@ -1,7 +1,7 @@
 name: Entity Reference Integrity Enforce
 description: Enforce reference integrity on entities.
 package: Entity Reference Integrity
-core_version_requirement: ^10
+core_version_requirement: ^10.2
 type: module
 
 dependencies:
-- 
GitLab


From 0960184d587ede0871b1a76634a4e0cd9569e835 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 12:28:00 -0500
Subject: [PATCH 04/15] Add .gitlab-ci.yml to run tests and linting.

---
 .gitlab-ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..e38c044
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,42 @@
+################
+# GitLabCI template for Drupal projects.
+#
+# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification.
+# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
+# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your
+# pipelines automatically. However, you can modify this template if you have additional needs for your project.
+# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/
+################
+
+# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/
+# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml
+include:
+  - project: $_GITLAB_TEMPLATES_REPO
+    ref: $_GITLAB_TEMPLATES_REF
+    file:
+      - '/includes/include.drupalci.main.yml'
+      - '/includes/include.drupalci.variables.yml'
+      - '/includes/include.drupalci.workflows.yml'
+#
+################
+# Pipeline configuration variables are defined with default values and descriptions in the file
+# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
+# Uncomment the lines below if you want to override any of the variables. The following is just an example.
+################
+variables:
+  OPT_IN_TEST_CURRENT: 1
+  OPT_IN_TEST_PREVIOUS_MAJOR: 1
+  OPT_IN_TEST_MAX_PHP: 1
+  _PHPUNIT_CONCURRENT: 1
+
+phpunit:
+  parallel:
+    matrix:
+      - _TARGET_DB_TYPE: 'mysql'
+        _TARGET_DB_VERSION: '8'
+      - _TARGET_DB_TYPE: 'pgsql'
+        _TARGET_DB_VERSION: '16'
+      - _TARGET_DB_TYPE: 'mariadb'
+        _TARGET_DB_VERSION: '10.6'
+      - _TARGET_DB_TYPE: 'sqlite'
+        _TARGET_DB_VERSION: '3'
-- 
GitLab


From ad62e0d6dd2e80aff4cfed097241715e67e7e271 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 10:39:42 -0500
Subject: [PATCH 05/15] Disable OPT_IN_TEST_CURRENT until we support Drupal 11.

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e38c044..8bf5a7b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,8 @@ include:
 # Uncomment the lines below if you want to override any of the variables. The following is just an example.
 ################
 variables:
-  OPT_IN_TEST_CURRENT: 1
+  # @todo https://www.drupal.org/project/entity_reference_integrity/issues/3455209
+  OPT_IN_TEST_CURRENT: 0
   OPT_IN_TEST_PREVIOUS_MAJOR: 1
   OPT_IN_TEST_MAX_PHP: 1
   _PHPUNIT_CONCURRENT: 1
-- 
GitLab


From 814850916876217b777bfe25627b3533f58e29af Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 13:44:09 -0500
Subject: [PATCH 06/15] Fix spelling errors flagged by cspell.

CSpell: Files checked: 29, Issues found: 2 in 2 files.
The number of distinct unrecognised/misspelled words is 2
------------
entityt
entties
------------
---
 src/EntityReferenceDependencyManagerInterface.php | 2 +-
 src/EntityReferenceIntegrityEntityHandler.php     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/EntityReferenceDependencyManagerInterface.php b/src/EntityReferenceDependencyManagerInterface.php
index 532d0f2..c2f4ecc 100644
--- a/src/EntityReferenceDependencyManagerInterface.php
+++ b/src/EntityReferenceDependencyManagerInterface.php
@@ -10,7 +10,7 @@ use Drupal\Core\Entity\EntityInterface;
 interface EntityReferenceDependencyManagerInterface {
 
   /**
-   * Check if an entity has dependent entties.
+   * Check if an entity has dependent entities.
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
    *   An entity.
diff --git a/src/EntityReferenceIntegrityEntityHandler.php b/src/EntityReferenceIntegrityEntityHandler.php
index aeb5a4f..9185e9c 100644
--- a/src/EntityReferenceIntegrityEntityHandler.php
+++ b/src/EntityReferenceIntegrityEntityHandler.php
@@ -103,7 +103,7 @@ class EntityReferenceIntegrityEntityHandler implements EntityHandlerInterface, E
    * source field list that match the given target ID.
    *
    * @param string $entity_type
-   *   The entityt type.
+   *   The entity type.
    * @param array $source_fields
    *   An array of source fields.
    * @param string|int $target_id
-- 
GitLab


From 02921a30b85c34680b46538cde013e852c9962e0 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 19:37:22 -0500
Subject: [PATCH 07/15] Inject config factory service into DeleteAction.

Fixes PHPStan error:

 ------ ----------------------------------------------------------------------------------------------------------------------
  Line   web/modules/entity_reference_integrity/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
 ------ ----------------------------------------------------------------------------------------------------------------------
  34     \Drupal calls should be avoided in classes, use dependency injection instead
 ------ ----------------------------------------------------------------------------------------------------------------------
---
 .../src/Plugin/Action/DeleteAction.php        | 48 ++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php b/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
index 6b6adcc..ff043d7 100644
--- a/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
+++ b/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
@@ -4,6 +4,7 @@ namespace Drupal\entity_reference_integrity_enforce\Plugin\Action;
 
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Action\Plugin\Action\DeleteAction as CoreDeleteAction;
+use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -17,6 +18,51 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
  */
 class DeleteAction extends CoreDeleteAction {
 
+  /**
+   * The config factory service.
+   *
+   * @var \Drupal\Core\Config\ConfigFactoryInterface
+   */
+  protected $configFactory;
+
+  /**
+   * Constructs a new DeleteAction 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\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
+   *   The tempstore factory.
+   * @param \Drupal\Core\Session\AccountInterface $current_user
+   *   Current user.
+   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+   *   The config factory service.
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, PrivateTempStoreFactory $temp_store_factory, AccountInterface $current_user, ConfigFactoryInterface $config_factory) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $temp_store_factory, $current_user);
+    $this->configFactory = $config_factory;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $container->get('entity_type.manager'),
+      $container->get('tempstore.private'),
+      $container->get('current_user'),
+      $container->get('config.factory'),
+    );
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -31,7 +77,7 @@ class DeleteAction extends CoreDeleteAction {
 
     // Check for dependent entities.
     $has_dependents = FALSE;
-    $enabled_entity_type_ids = \Drupal::config('entity_reference_integrity_enforce.settings')->get('enabled_entity_type_ids');
+    $enabled_entity_type_ids = $this->configFactory->get('entity_reference_integrity_enforce.settings')->get('enabled_entity_type_ids');
     if (in_array($object->getEntityTypeId(), $enabled_entity_type_ids, TRUE)) {
       $has_dependents = $this->entityTypeManager->getHandler($object->getEntityTypeId(), 'entity_reference_integrity')->hasDependents($object);
     }
-- 
GitLab


From eeade56bccf5bae63ee8c419f44ceb373f02d859 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 19:51:37 -0500
Subject: [PATCH 08/15] Replace deprecated EntityReferenceTestTrait with
 EntityReferenceFieldCreationTrait.

Fixes the following PHPStan errors:

 ------ ------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/entity_reference_integrity/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
 ------ ------------------------------------------------------------------------------------------------------------------------
  22     Usage of deprecated trait Drupal\Tests\field\Traits\EntityReferenceTestTrait in class
         Drupal\Tests\entity_reference_integrity_enforce\Functional\JsonApiTest:
         in drupal:10.2.0 and is removed from drupal:11.0.0. Use
            \Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait instead.
 ------ ------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/entity_reference_integrity/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
 ------ -------------------------------------------------------------------------------------------------------------------------
  21     Usage of deprecated trait Drupal\Tests\field\Traits\EntityReferenceTestTrait in class
         Drupal\Tests\entity_reference_integrity_enforce\Kernel\DeleteActionTest:
         in drupal:10.2.0 and is removed from drupal:11.0.0. Use
            \Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait instead.
 ------ -------------------------------------------------------------------------------------------------------------------------
---
 .../tests/src/Functional/JsonApiTest.php                      | 4 ++--
 .../tests/src/Kernel/DeleteActionTest.php                     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
index 917ced0..ab302c8 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
@@ -8,7 +8,7 @@ use Drupal\Core\Url;
 use Drupal\entity_reference_integrity\EntityReferenceIntegrityEntityHandler;
 use Drupal\node\Entity\NodeType;
 use Drupal\Tests\BrowserTestBase;
-use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
+use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
 use Drupal\Tests\jsonapi\Functional\JsonApiRequestTestTrait;
 use GuzzleHttp\RequestOptions;
 
@@ -19,7 +19,7 @@ use GuzzleHttp\RequestOptions;
  */
 class JsonApiTest extends BrowserTestBase {
 
-  use EntityReferenceTestTrait;
+  use EntityReferenceFieldCreationTrait;
   use JsonApiRequestTestTrait;
   use StringTranslationTrait;
 
diff --git a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
index c4baa50..2956db1 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
@@ -6,7 +6,7 @@ use Drupal\entity_reference_integrity_enforce\Plugin\Action\DeleteAction;
 use Drupal\KernelTests\KernelTestBase;
 use Drupal\node\Entity\Node;
 use Drupal\node\Entity\NodeType;
-use Drupal\Tests\field\Traits\EntityReferenceTestTrait;
+use Drupal\Tests\field\Traits\EntityReferenceFieldCreationTrait;
 use Drupal\user\Entity\User;
 
 /**
@@ -18,7 +18,7 @@ use Drupal\user\Entity\User;
  */
 class DeleteActionTest extends KernelTestBase {
 
-  use EntityReferenceTestTrait;
+  use EntityReferenceFieldCreationTrait;
 
   /**
    * {@inheritdoc}
-- 
GitLab


From 9ba3ced57a203f1082255dd2edd0f1409620fa44 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 07:31:00 -0500
Subject: [PATCH 09/15] Add $typedConfigManager to SettingsForm::__construct().

See core change record: https://www.drupal.org/node/3404140

Fixes the following PHPStan error:

 ------ ----------------------------------------------------------------------
  Line   modules/entity_reference_integrity_enforce/src/Form/SettingsForm.php
 ------ ----------------------------------------------------------------------
  26     Method Drupal\Core\Form\ConfigFormBase::__construct() invoked with 1
         parameter, 2 required.
 ------ ----------------------------------------------------------------------
---
 .../src/Form/SettingsForm.php                  | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/entity_reference_integrity_enforce/src/Form/SettingsForm.php b/modules/entity_reference_integrity_enforce/src/Form/SettingsForm.php
index 215a2f3..d4fc9e6 100644
--- a/modules/entity_reference_integrity_enforce/src/Form/SettingsForm.php
+++ b/modules/entity_reference_integrity_enforce/src/Form/SettingsForm.php
@@ -3,6 +3,8 @@
 namespace Drupal\entity_reference_integrity_enforce\Form;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Config\TypedConfigManagerInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -21,10 +23,17 @@ class SettingsForm extends ConfigFormBase {
 
   /**
    * Create a SettingsForm.
+   *
+   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
+   *   Defines the configuration object factory.
+   * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
+   *   The typed config manager.
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+   *   The entity type manager service.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, $entity_type_definitions) {
-    parent::__construct($config_factory);
-    $this->entityTypeDefinitions = $entity_type_definitions;
+  public function __construct(ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config_manager, EntityTypeManagerInterface $entity_type_manager) {
+    parent::__construct($config_factory, $typed_config_manager);
+    $this->entityTypeDefinitions = $entity_type_manager->getDefinitions();
   }
 
   /**
@@ -33,7 +42,8 @@ class SettingsForm extends ConfigFormBase {
   public static function create(ContainerInterface $container) {
     return new static(
       $container->get('config.factory'),
-      $container->get('entity_type.manager')->getDefinitions()
+      $container->get('config.typed'),
+      $container->get('entity_type.manager'),
     );
   }
 
-- 
GitLab


From a0a9c0b6ac4fa3125291a5551bbb78d1e109a322 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 20:04:19 -0500
Subject: [PATCH 10/15] Fix phpcs: Description for the @return value is missing

---
 src/EntityReferenceDependencyManagerInterface.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/EntityReferenceDependencyManagerInterface.php b/src/EntityReferenceDependencyManagerInterface.php
index c2f4ecc..988a5cc 100644
--- a/src/EntityReferenceDependencyManagerInterface.php
+++ b/src/EntityReferenceDependencyManagerInterface.php
@@ -51,6 +51,7 @@ interface EntityReferenceDependencyManagerInterface {
    *   Optional boolean to translate the string. Defaults to TRUE.
    *
    * @return string
+   *   The access denied reason string.
    */
   public static function getAccessDeniedReason(EntityInterface $entity, bool $translate = TRUE);
 
-- 
GitLab


From 157ebe3149bb4906ea2e8840ed52193effc2f823 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 20:09:15 -0500
Subject: [PATCH 11/15] Fix phpcs: Use null coalesce operator instead of
 ternary operator.

---
 src/DependencyFieldMapGenerator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/DependencyFieldMapGenerator.php b/src/DependencyFieldMapGenerator.php
index 19ee82f..01bc269 100644
--- a/src/DependencyFieldMapGenerator.php
+++ b/src/DependencyFieldMapGenerator.php
@@ -90,7 +90,7 @@ class DependencyFieldMapGenerator implements DependencyFieldMapGeneratorInterfac
    */
   public function getReferencingFields($entity_type_id) {
     $map = $this->getReferentialFieldMap();
-    return isset($map[$entity_type_id]) ? $map[$entity_type_id] : [];
+    return $map[$entity_type_id] ?? [];
   }
 
 }
-- 
GitLab


From 0445a11c53076f47d169e4bae14d05ad53f8f079 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 20:10:19 -0500
Subject: [PATCH 12/15] Fix phpcs: Object operator not indented correctly;
 expected 6 spaces but found 11

---
 .../tests/src/Kernel/DeleteActionTest.php                   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
index 2956db1..10b3eaf 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
@@ -107,9 +107,9 @@ class DeleteActionTest extends KernelTestBase {
 
     // Enable reference integrity for nodes.
     \Drupal::configFactory()
-           ->getEditable('entity_reference_integrity_enforce.settings')
-           ->set('enabled_entity_type_ids', ['node' => 'node'])
-           ->save();
+      ->getEditable('entity_reference_integrity_enforce.settings')
+      ->set('enabled_entity_type_ids', ['node' => 'node'])
+      ->save();
 
     // A test user is required for testing access.
     $this->testUser = User::create([
-- 
GitLab


From bbfcd664214079fcc1ef488f5c052d1a6b480824 Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 20:11:20 -0500
Subject: [PATCH 13/15] Fix phpcs: Expected 1 blank line after function; 0
 found

---
 .../tests/src/Functional/JsonApiTest.php                         | 1 +
 .../tests/src/Kernel/DeleteActionTest.php                        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
index ab302c8..f1843f8 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
@@ -176,4 +176,5 @@ class JsonApiTest extends BrowserTestBase {
     $response = $this->request('DELETE', $node_url, $request_options);
     $this->assertEquals(204, $response->getStatusCode());
   }
+
 }
diff --git a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
index 10b3eaf..3b23a59 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Kernel/DeleteActionTest.php
@@ -141,4 +141,5 @@ class DeleteActionTest extends KernelTestBase {
     $this->assertFalse($this->dependencyManager->hasDependents($this->referencedNode));
     $this->assertTrue($action->access($this->referencedNode, $this->testUser));
   }
+
 }
-- 
GitLab


From 72b64efe416fe62168bc6053a32887a0e2c3a89e Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Thu, 27 Feb 2025 20:12:43 -0500
Subject: [PATCH 14/15] Fix phpcs: sizeof() is a function name alias, use
 count() instead

---
 .../tests/src/Functional/JsonApiTest.php                        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
index f1843f8..bdc939e 100644
--- a/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
+++ b/modules/entity_reference_integrity_enforce/tests/src/Functional/JsonApiTest.php
@@ -151,7 +151,7 @@ class JsonApiTest extends BrowserTestBase {
     // Assert valid response body. Should be a JSONAPI response with errors.
     $response_data = Json::decode((string) $response->getBody());
     $this->assertArrayHasKey('errors', $response_data);
-    $this->assertEquals(1, sizeof($response_data['errors']));
+    $this->assertEquals(1, count($response_data['errors']));
     $this->assertArrayHasKey('status', $response_data['errors'][0]);
     $this->assertEquals('403', $response_data['errors'][0]['status']);
 
-- 
GitLab


From f6d45e8c6d777091fef420c28949bd13c91b3ebd Mon Sep 17 00:00:00 2001
From: Michael Stenta <mike@mstenta.net>
Date: Fri, 28 Feb 2025 06:28:38 -0500
Subject: [PATCH 15/15] Fix phpcs: Parameter $account has null default value,
 but is not marked as nullable.

---
 .../src/Plugin/Action/DeleteAction.php                          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php b/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
index ff043d7..b212355 100644
--- a/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
+++ b/modules/entity_reference_integrity_enforce/src/Plugin/Action/DeleteAction.php
@@ -66,7 +66,7 @@ class DeleteAction extends CoreDeleteAction {
   /**
    * {@inheritdoc}
    */
-  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+  public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE) {
     // First check if the account has access.
     $access = parent::access($object, $account, TRUE);
 
-- 
GitLab