From e2f9b0c99f3dfd38172655414e7f924640e59473 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Fri, 1 Mar 2024 11:40:30 +0000
Subject: [PATCH] Issue #3247331 by mikelutz, smustgrave: Deprecate
 MigrateSkipProcessException

---
 .../src/MigrateSkipProcessException.php       | 10 +++++++
 .../MigrateSkipProcessExceptionTest.php       | 26 +++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 core/modules/migrate/tests/src/Unit/Exception/MigrateSkipProcessExceptionTest.php

diff --git a/core/modules/migrate/src/MigrateSkipProcessException.php b/core/modules/migrate/src/MigrateSkipProcessException.php
index 2b8823e4afba..1e993a93a418 100644
--- a/core/modules/migrate/src/MigrateSkipProcessException.php
+++ b/core/modules/migrate/src/MigrateSkipProcessException.php
@@ -4,7 +4,17 @@
 
 /**
  * This exception is thrown when the rest of the process should be skipped.
+ *
+ * @deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Return FALSE from a process
+ *   plugin's isPipelineStopped() method to stop further processing on a
+ *   pipeline.
+ * @see https://www.drupal.org/node/3414511
  */
 class MigrateSkipProcessException extends \Exception {
 
+  public function __construct(string $message = "", int $code = 0, ?\Throwable $previous = NULL) {
+    trigger_error(__CLASS__ . " is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Return TRUE from a process plugin's isPipelineStopped() method to halt further processing on a pipeline. See https://www.drupal.org/node/3414511", E_USER_DEPRECATED);
+    parent::__construct($message, $code, $previous);
+  }
+
 }
diff --git a/core/modules/migrate/tests/src/Unit/Exception/MigrateSkipProcessExceptionTest.php b/core/modules/migrate/tests/src/Unit/Exception/MigrateSkipProcessExceptionTest.php
new file mode 100644
index 000000000000..15e218b08929
--- /dev/null
+++ b/core/modules/migrate/tests/src/Unit/Exception/MigrateSkipProcessExceptionTest.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\migrate\Unit\Exception;
+
+use Drupal\migrate\MigrateSkipProcessException;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Tests deprecation error on MigrateSkipProcessException.
+ *
+ * @group legacy
+ */
+class MigrateSkipProcessExceptionTest extends UnitTestCase {
+
+  /**
+   * Tests a deprecation error is triggered on throw.
+   */
+  public function testDeprecation(): void {
+    $this->expectException(MigrateSkipProcessException::class);
+    $this->expectDeprecation("Unsilenced deprecation: " . MigrateSkipProcessException::class . " is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Return TRUE from a process plugin's isPipelineStopped() method to halt further processing on a pipeline. See https://www.drupal.org/node/3414511");
+    throw new MigrateSkipProcessException();
+  }
+
+}
-- 
GitLab