diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php
index cdc32086a3da070babcb0aa55e0958dfd411bfce..de4ec2e646027a6a295b6a8efd045059098742eb 100644
--- a/core/.phpstan-baseline.php
+++ b/core/.phpstan-baseline.php
@@ -53223,12 +53223,6 @@
 	'count' => 1,
 	'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/WorkflowCustomAccessType.php',
 ];
-$ignoreErrors[] = [
-	'message' => '#^Function workflow_type_test_set_definitions\\(\\) has no return type specified\\.$#',
-	'identifier' => 'missingType.return',
-	'count' => 1,
-	'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module',
-];
 $ignoreErrors[] = [
 	'message' => '#^Method Drupal\\\\Tests\\\\workflows\\\\Functional\\\\Rest\\\\WorkflowJsonAnonTest\\:\\:assertAuthenticationEdgeCases\\(\\) has no return type specified\\.$#',
 	'identifier' => 'missingType.return',
diff --git a/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module b/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module
deleted file mode 100644
index f74b802cdfb0c73fd34e11a6d7a03ef11a615c51..0000000000000000000000000000000000000000
--- a/core/modules/workflows/tests/modules/workflow_type_test/workflow_type_test.module
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-/**
- * @file
- * Module file for workflow_type_test.
- */
-
-declare(strict_types=1);
-
-/**
- * Sets the type plugin definitions override and clear the cache.
- *
- * @param array $definitions
- *   Definitions to set.
- */
-function workflow_type_test_set_definitions($definitions) {
-  \Drupal::state()->set('workflow_type_test.plugin_definitions', $definitions);
-  \Drupal::service('plugin.manager.workflows.type')->clearCachedDefinitions();
-}
diff --git a/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php b/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php
index b3e3d9a9c2080574253b1a8dad8527ef08205c92..f24e427b2ef3bef878883e39943f356b2227d0c4 100644
--- a/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php
+++ b/core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php
@@ -88,7 +88,8 @@ public function testCheckCreateAccess(): void {
 
     // Remove all plugin types and ensure not even the admin user is allowed to
     // create a workflow.
-    workflow_type_test_set_definitions([]);
+    $this->container->get('state')->set('workflow_type_test.plugin_definitions', []);
+    $this->container->get('plugin.manager.workflows.type')->clearCachedDefinitions();
     $this->accessControlHandler->resetCache();
     $this->assertEquals(
       AccessResult::neutral()