diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php
index 2cd5515acb710f6e62e3e054a7a32f2a20c9fafe..75b67460e62964ba56b728d5fbf006200d029397 100644
--- a/core/.phpstan-baseline.php
+++ b/core/.phpstan-baseline.php
@@ -1298,12 +1298,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/modules/migrate/tests/src/Kernel/MigrateTestBase.php',
 ];
-$ignoreErrors[] = [
-	// identifier: method.deprecated
-	'message' => '#^Call to deprecated method getMockForAbstractClass\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\MockBuilder\\.$#',
-	'count' => 1,
-	'path' => __DIR__ . '/modules/migrate/tests/src/Unit/MigrateExecutableTest.php',
-];
 $ignoreErrors[] = [
 	// identifier: variable.undefined
 	'message' => '#^Variable \\$sub_process_plugins might not be defined\\.$#',
diff --git a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
index 05114d778b5f68b2e054b0fd50ba375ab4fa0f0b..8325f96bb6e5ee6f7986c93b7666988fd9c6140f 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateExecutableTest.php
@@ -440,18 +440,9 @@ public function testProcessRowEmptyDestination(): void {
    *   The mocked migration source.
    */
   protected function getMockSource() {
-    $this->createMock('\Iterator');
-
-    $class = 'Drupal\migrate\Plugin\migrate\source\SourcePluginBase';
-    $source = $this->getMockBuilder($class)
-      ->disableOriginalConstructor()
-      ->onlyMethods(get_class_methods($class))
-      ->getMockForAbstractClass();
+    $source = $this->createMock(StubSourcePlugin::class);
     $source->expects($this->once())
       ->method('rewind');
-    $source->expects($this->any())
-      ->method('initializeIterator')
-      ->willReturn([]);
     $source->expects($this->any())
       ->method('valid')
       ->willReturn(TRUE, FALSE);
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
index e853f974203c72925396cffd9766cedabd1374ff..2f0b85ffbc472e18ebd69cbb7e183588ee09f1da 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
@@ -450,51 +450,6 @@ protected function getMigrateExecutable($migration) {
 
 }
 
-/**
- * Stubbed source plugin for testing base class implementations.
- */
-class StubSourcePlugin extends SourcePluginBase {
-
-  /**
-   * Helper for setting internal module handler implementation.
-   *
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   */
-  public function setModuleHandler(ModuleHandlerInterface $module_handler) {
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function fields() {
-    return [];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function __toString() {
-    return '';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getIds() {
-    return [];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function initializeIterator() {
-    return [];
-  }
-
-}
-
 /**
  * Defines a stubbed source plugin with a generator as iterator.
  *
@@ -542,15 +497,10 @@ public function getTrackChanges() {
   /**
    * {@inheritdoc}
    */
-  protected function initializeIterator() {
-    $data = [
-      ['title' => 'foo'],
-      ['title' => 'bar'],
-      ['title' => 'iggy'],
-    ];
-    foreach ($data as $row) {
-      yield $row;
-    }
+  protected function initializeIterator(): \Generator {
+    yield 'foo';
+    yield 'bar';
+    yield 'iggy';
   }
 
 }
diff --git a/core/modules/migrate/tests/src/Unit/StubSourcePlugin.php b/core/modules/migrate/tests/src/Unit/StubSourcePlugin.php
new file mode 100644
index 0000000000000000000000000000000000000000..b7a52d926e1f086dedca1b22086a956c8f91f01d
--- /dev/null
+++ b/core/modules/migrate/tests/src/Unit/StubSourcePlugin.php
@@ -0,0 +1,53 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Drupal\Tests\migrate\Unit;
+
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
+
+/**
+ * Stubbed source plugin for testing base class implementations.
+ */
+class StubSourcePlugin extends SourcePluginBase {
+
+  /**
+   * Helper for setting internal module handler implementation.
+   *
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler.
+   */
+  public function setModuleHandler(ModuleHandlerInterface $module_handler): void {
+    $this->moduleHandler = $module_handler;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields(): array {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __toString(): string {
+    return '';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds(): array {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function initializeIterator(): \Iterator {
+    return [];
+  }
+
+}