From 231324d5d32a9521d02627d3cfb84f5a913844e1 Mon Sep 17 00:00:00 2001
From: Tim Rohaly <tr@202830.no-reply.drupal.org>
Date: Fri, 10 Jan 2020 21:09:17 +0000
Subject: [PATCH] Issue #2677094 by TR: Execution state and execution metadata
 state classes belong to the Context component

---
 src/Context/ContextHandlerIntegrityTrait.php  |  3 +--
 src/Context/ContextHandlerTrait.php           | 20 +++++++++----------
 src/Context/DataProcessorInterface.php        |  4 +---
 .../ExecutionMetadataState.php                |  3 +--
 .../ExecutionMetadataStateInterface.php       |  2 +-
 src/{Engine => Context}/ExecutionState.php    |  6 +++---
 .../ExecutionStateInterface.php               |  7 +++----
 src/Engine/ConditionExpressionContainer.php   |  1 +
 src/Engine/ExpressionBase.php                 |  1 +
 src/Engine/ExpressionContainerBase.php        |  1 +
 src/Engine/ExpressionInterface.php            |  8 +++++---
 src/Engine/RulesComponent.php                 |  8 +++++---
 .../GenericEventSubscriber.php                |  2 +-
 .../RulesDataProcessor/NumericOffset.php      |  2 +-
 .../RulesDataProcessor/TokenProcessor.php     |  2 +-
 .../RulesExpression/ActionExpression.php      |  4 ++--
 .../RulesExpression/ActionSetExpression.php   |  2 +-
 src/Plugin/RulesExpression/AndExpression.php  |  2 +-
 .../RulesExpression/ConditionExpression.php   |  4 ++--
 src/Plugin/RulesExpression/LoopExpression.php |  4 ++--
 src/Plugin/RulesExpression/OrExpression.php   |  2 +-
 src/Plugin/RulesExpression/RuleExpression.php |  4 ++--
 tests/src/Kernel/RulesEngineTest.php          |  2 +-
 tests/src/Unit/ActionSetExpressionTest.php    |  2 +-
 tests/src/Unit/AndExpressionTest.php          |  2 +-
 tests/src/Unit/ConditionExpressionTest.php    |  2 +-
 tests/src/Unit/ContextHandlerTraitTest.php    |  2 +-
 .../PrepareExecutionMetadataStateTest.php     |  2 +-
 .../Integration/Engine/RulesComponentTest.php |  2 +-
 tests/src/Unit/OrExpressionTest.php           |  2 +-
 tests/src/Unit/RuleExpressionTest.php         |  2 +-
 .../src/Unit/RulesConditionContainerTest.php  |  2 +-
 tests/src/Unit/RulesUnitTestBase.php          |  2 +-
 33 files changed, 57 insertions(+), 57 deletions(-)
 rename src/{Engine => Context}/ExecutionMetadataState.php (97%)
 rename src/{Engine => Context}/ExecutionMetadataStateInterface.php (98%)
 rename src/{Engine => Context}/ExecutionState.php (97%)
 rename src/{Engine => Context}/ExecutionStateInterface.php (94%)

diff --git a/src/Context/ContextHandlerIntegrityTrait.php b/src/Context/ContextHandlerIntegrityTrait.php
index 8760146e..31b4c231 100644
--- a/src/Context/ContextHandlerIntegrityTrait.php
+++ b/src/Context/ContextHandlerIntegrityTrait.php
@@ -10,7 +10,6 @@ use Drupal\rules\Context\ContextDefinitionInterface as RulesContextDefinitionInt
 use Drupal\rules\Context\ContextProviderInterface;
 //@codingStandardsIgnoreEnd
 use Drupal\rules\Exception\IntegrityException;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
 use Drupal\rules\Engine\IntegrityViolation;
 use Drupal\rules\Engine\IntegrityViolationList;
 
@@ -26,7 +25,7 @@ trait ContextHandlerIntegrityTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The plugin with its defined context.
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The current configuration state with all defined variables that are
    *   available.
    *
diff --git a/src/Context/ContextHandlerTrait.php b/src/Context/ContextHandlerTrait.php
index 215b2510..37ccb908 100644
--- a/src/Context/ContextHandlerTrait.php
+++ b/src/Context/ContextHandlerTrait.php
@@ -4,8 +4,6 @@ namespace Drupal\rules\Context;
 
 use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Core\Plugin\ContextAwarePluginInterface as CoreContextAwarePluginInterface;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Exception\EvaluationException;
 use Drupal\rules\Exception\IntegrityException;
 
@@ -38,7 +36,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The plugin that is populated with context values.
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $state
    *   The execution state containing available variables.
    *
    * @throws \Drupal\rules\Exception\EvaluationException
@@ -111,7 +109,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The plugin that is prepared.
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The metadata state, prepared for the current expression.
    *
    * @throws \Drupal\Component\Plugin\Exception\ContextException
@@ -146,7 +144,7 @@ trait ContextHandlerTrait {
   /**
    * Gets definitions of all selected data at configuration time.
    *
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The metadata state.
    *
    * @return \Drupal\Core\TypedData\DataDefinitionInterface[]
@@ -179,7 +177,7 @@ trait ContextHandlerTrait {
    *
    * @param string $context_name
    *   The name of the context.
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The metadata state containing metadata about available variables.
    *
    * @return \Drupal\Core\TypedData\DataDefinitionInterface|null
@@ -201,7 +199,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The context aware plugin of which to add provided context.
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $state
    *   The Rules state where the context variables are added.
    */
   protected function addProvidedContext(CoreContextAwarePluginInterface $plugin, ExecutionStateInterface $state) {
@@ -227,7 +225,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The context aware plugin of which to add provided context.
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The execution metadata state to add variables to.
    */
   protected function addProvidedContextDefinitions(CoreContextAwarePluginInterface $plugin, ExecutionMetadataStateInterface $metadata_state) {
@@ -257,7 +255,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The context aware plugin.
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The execution metadata state.
    */
   protected function assertMetadata(CoreContextAwarePluginInterface $plugin, ExecutionMetadataStateInterface $metadata_state) {
@@ -282,7 +280,7 @@ trait ContextHandlerTrait {
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   The plugin to process the context data on.
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $rules_state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $rules_state
    *   The current Rules execution state with context variables.
    */
   protected function processData(CoreContextAwarePluginInterface $plugin, ExecutionStateInterface $rules_state) {
@@ -310,7 +308,7 @@ trait ContextHandlerTrait {
    *   The current value.
    * @param array $processors
    *   An array mapping processor plugin IDs to their configuration.
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $rules_state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $rules_state
    *   The current Rules execution state with context variables.
    *
    * @return mixed
diff --git a/src/Context/DataProcessorInterface.php b/src/Context/DataProcessorInterface.php
index 0fab75a1..224f59ac 100644
--- a/src/Context/DataProcessorInterface.php
+++ b/src/Context/DataProcessorInterface.php
@@ -2,8 +2,6 @@
 
 namespace Drupal\rules\Context;
 
-use Drupal\rules\Engine\ExecutionStateInterface;
-
 /**
  * Interface for Rules data processor plugins.
  */
@@ -14,7 +12,7 @@ interface DataProcessorInterface {
    *
    * @param mixed $value
    *   The value to process.
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $rules_state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $rules_state
    *   The current Rules execution state containing all context variables.
    *
    * @return mixed
diff --git a/src/Engine/ExecutionMetadataState.php b/src/Context/ExecutionMetadataState.php
similarity index 97%
rename from src/Engine/ExecutionMetadataState.php
rename to src/Context/ExecutionMetadataState.php
index dbc5d8a3..610731ab 100644
--- a/src/Engine/ExecutionMetadataState.php
+++ b/src/Context/ExecutionMetadataState.php
@@ -1,10 +1,9 @@
 <?php
 
-namespace Drupal\rules\Engine;
+namespace Drupal\rules\Context;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\TypedData\DataDefinitionInterface;
-use Drupal\rules\Context\GlobalContextRepositoryTrait;
 use Drupal\rules\Exception\IntegrityException;
 use Drupal\typed_data\DataFetcherTrait;
 use Drupal\typed_data\Exception\TypedDataException;
diff --git a/src/Engine/ExecutionMetadataStateInterface.php b/src/Context/ExecutionMetadataStateInterface.php
similarity index 98%
rename from src/Engine/ExecutionMetadataStateInterface.php
rename to src/Context/ExecutionMetadataStateInterface.php
index b61e0d35..5ec8bfaa 100644
--- a/src/Engine/ExecutionMetadataStateInterface.php
+++ b/src/Context/ExecutionMetadataStateInterface.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\rules\Engine;
+namespace Drupal\rules\Context;
 
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\TypedData\DataDefinitionInterface;
diff --git a/src/Engine/ExecutionState.php b/src/Context/ExecutionState.php
similarity index 97%
rename from src/Engine/ExecutionState.php
rename to src/Context/ExecutionState.php
index 9bf8a162..3600645e 100644
--- a/src/Engine/ExecutionState.php
+++ b/src/Context/ExecutionState.php
@@ -1,12 +1,10 @@
 <?php
 
-namespace Drupal\rules\Engine;
+namespace Drupal\rules\Context;
 
 use Drupal\Core\TypedData\Exception\MissingDataException;
 use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedDataTrait;
-use Drupal\rules\Context\ContextDefinitionInterface;
-use Drupal\rules\Context\GlobalContextRepositoryTrait;
 use Drupal\rules\Exception\EvaluationException;
 use Drupal\rules\Exception\InvalidArgumentException;
 use Drupal\typed_data\DataFetcherTrait;
@@ -28,6 +26,8 @@ class ExecutionState implements ExecutionStateInterface {
    * @var array
    *
    * @todo Implement recursion prevention from D7.
+   * @todo Move this out of Context namespace?
+   * @see https://www.drupal.org/project/rules/issues/2677094
    */
   static protected $blocked = [];
 
diff --git a/src/Engine/ExecutionStateInterface.php b/src/Context/ExecutionStateInterface.php
similarity index 94%
rename from src/Engine/ExecutionStateInterface.php
rename to src/Context/ExecutionStateInterface.php
index 7757316a..8496062e 100644
--- a/src/Engine/ExecutionStateInterface.php
+++ b/src/Context/ExecutionStateInterface.php
@@ -1,12 +1,11 @@
 <?php
 
-namespace Drupal\rules\Engine;
+namespace Drupal\rules\Context;
 
 use Drupal\Core\TypedData\TypedDataInterface;
-use Drupal\rules\Context\ContextDefinitionInterface;
 
 /**
- * Defines an interface for the rules state.
+ * Defines an interface for the execution context state.
  */
 interface ExecutionStateInterface {
 
@@ -67,7 +66,7 @@ interface ExecutionStateInterface {
   public function getVariableValue($name);
 
   /**
-   * Checks if a variable exists by name in the Rules state.
+   * Checks if a variable exists by name in the execution state.
    *
    * @param string $name
    *   The variable name.
diff --git a/src/Engine/ConditionExpressionContainer.php b/src/Engine/ConditionExpressionContainer.php
index 7b05191d..be12c085 100644
--- a/src/Engine/ConditionExpressionContainer.php
+++ b/src/Engine/ConditionExpressionContainer.php
@@ -5,6 +5,7 @@ namespace Drupal\rules\Engine;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\rules\Context\ContextConfig;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Exception\InvalidExpressionException;
 
 /**
diff --git a/src/Engine/ExpressionBase.php b/src/Engine/ExpressionBase.php
index cbfc41b3..7a96385b 100644
--- a/src/Engine/ExpressionBase.php
+++ b/src/Engine/ExpressionBase.php
@@ -3,6 +3,7 @@
 namespace Drupal\rules\Engine;
 
 use Drupal\Core\Plugin\PluginBase;
+use Drupal\rules\Context\ExecutionState;
 
 /**
  * Base class for rules expressions.
diff --git a/src/Engine/ExpressionContainerBase.php b/src/Engine/ExpressionContainerBase.php
index 86b4fb7a..a7572020 100644
--- a/src/Engine/ExpressionContainerBase.php
+++ b/src/Engine/ExpressionContainerBase.php
@@ -3,6 +3,7 @@
 namespace Drupal\rules\Engine;
 
 use Drupal\rules\Context\ContextConfig;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
diff --git a/src/Engine/ExpressionInterface.php b/src/Engine/ExpressionInterface.php
index d74479a1..77052b12 100644
--- a/src/Engine/ExpressionInterface.php
+++ b/src/Engine/ExpressionInterface.php
@@ -6,6 +6,8 @@ use Drupal\Component\Plugin\ConfigurableInterface;
 use Drupal\Component\Plugin\DependentPluginInterface;
 use Drupal\Component\Plugin\PluginInspectionInterface;
 use Drupal\Core\Executable\ExecutableInterface;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 
 /**
  * Defines the interface for Rules expressions.
@@ -19,7 +21,7 @@ interface ExpressionInterface extends ExecutableInterface, ConfigurableInterface
    *
    * Note that this does not auto-save any changes.
    *
-   * @param \Drupal\rules\Engine\ExecutionStateInterface $state
+   * @param \Drupal\rules\Context\ExecutionStateInterface $state
    *   The state with all the execution variables in it.
    *
    * @return null|bool
@@ -114,7 +116,7 @@ interface ExpressionInterface extends ExecutableInterface, ConfigurableInterface
    * This allows for efficient integrity checks of expression trees; e.g. see
    * \Drupal\rules\Engine\ActionExpressionContainer::checkIntegrity().
    *
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The execution metadata state, prepared until right before this
    *   expression.
    * @param bool $apply_assertions
@@ -145,7 +147,7 @@ interface ExpressionInterface extends ExecutableInterface, ConfigurableInterface
    * $until = NULL reflects the execution metadata state at the end of the
    * expression execution.
    *
-   * @param \Drupal\rules\Engine\ExecutionMetadataStateInterface $metadata_state
+   * @param \Drupal\rules\Context\ExecutionMetadataStateInterface $metadata_state
    *   The execution metadata state, prepared until right before this
    *   expression.
    * @param \Drupal\rules\Engine\ExpressionInterface $until
diff --git a/src/Engine/RulesComponent.php b/src/Engine/RulesComponent.php
index 0e798f6d..2daf03cf 100644
--- a/src/Engine/RulesComponent.php
+++ b/src/Engine/RulesComponent.php
@@ -5,6 +5,8 @@ namespace Drupal\rules\Engine;
 use Drupal\Core\Entity\DependencyTrait;
 use Drupal\rules\Context\ContextDefinition;
 use Drupal\rules\Context\ContextDefinitionInterface;
+use Drupal\rules\Context\ExecutionMetadataState;
+use Drupal\rules\Context\ExecutionState;
 use Drupal\rules\Exception\LogicException;
 
 /**
@@ -16,7 +18,7 @@ class RulesComponent {
   /**
    * The rules execution state.
    *
-   * @var \Drupal\rules\Engine\ExecutionStateInterface
+   * @var \Drupal\rules\Context\ExecutionStateInterface
    */
   protected $state;
 
@@ -124,7 +126,7 @@ class RulesComponent {
   /**
    * Gets the execution state.
    *
-   * @return \Drupal\rules\Engine\ExecutionStateInterface
+   * @return \Drupal\rules\Context\ExecutionStateInterface
    *   The execution state for this component.
    */
   public function getState() {
@@ -294,7 +296,7 @@ class RulesComponent {
    * Describes the metadata state before execution - only context definitions
    * are set as variables.
    *
-   * @return \Drupal\rules\Engine\ExecutionMetadataStateInterface
+   * @return \Drupal\rules\Context\ExecutionMetadataStateInterface
    *   The execution metadata state populated with context definitions.
    */
   public function getMetadataState() {
diff --git a/src/EventSubscriber/GenericEventSubscriber.php b/src/EventSubscriber/GenericEventSubscriber.php
index d358f182..ca4cc3a3 100644
--- a/src/EventSubscriber/GenericEventSubscriber.php
+++ b/src/EventSubscriber/GenericEventSubscriber.php
@@ -4,9 +4,9 @@ namespace Drupal\rules\EventSubscriber;
 
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Logger\LoggerChannelInterface;
+use Drupal\rules\Context\ExecutionState;
 use Drupal\rules\Core\RulesConfigurableEventHandlerInterface;
 use Drupal\rules\Core\RulesEventManager;
-use Drupal\rules\Engine\ExecutionState;
 use Drupal\rules\Engine\RulesComponentRepositoryInterface;
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
diff --git a/src/Plugin/RulesDataProcessor/NumericOffset.php b/src/Plugin/RulesDataProcessor/NumericOffset.php
index b6c97d28..1c58aeb7 100644
--- a/src/Plugin/RulesDataProcessor/NumericOffset.php
+++ b/src/Plugin/RulesDataProcessor/NumericOffset.php
@@ -4,7 +4,7 @@ namespace Drupal\rules\Plugin\RulesDataProcessor;
 
 use Drupal\Core\Plugin\PluginBase;
 use Drupal\rules\Context\DataProcessorInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 
 /**
  * A data processor for applying numerical offsets.
diff --git a/src/Plugin/RulesDataProcessor/TokenProcessor.php b/src/Plugin/RulesDataProcessor/TokenProcessor.php
index c9e2fd66..92f93b29 100644
--- a/src/Plugin/RulesDataProcessor/TokenProcessor.php
+++ b/src/Plugin/RulesDataProcessor/TokenProcessor.php
@@ -5,7 +5,7 @@ namespace Drupal\rules\Plugin\RulesDataProcessor;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Plugin\PluginBase;
 use Drupal\rules\Context\DataProcessorInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\typed_data\PlaceholderResolverInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
diff --git a/src/Plugin/RulesExpression/ActionExpression.php b/src/Plugin/RulesExpression/ActionExpression.php
index b1bc217b..455ec0a6 100644
--- a/src/Plugin/RulesExpression/ActionExpression.php
+++ b/src/Plugin/RulesExpression/ActionExpression.php
@@ -5,10 +5,10 @@ namespace Drupal\rules\Plugin\RulesExpression;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\rules\Context\DataProcessorManager;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Core\RulesActionManagerInterface;
 use Drupal\rules\Engine\ActionExpressionInterface;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\ExpressionBase;
 use Drupal\rules\Engine\ExpressionInterface;
 use Drupal\rules\Context\ContextHandlerIntegrityTrait;
diff --git a/src/Plugin/RulesExpression/ActionSetExpression.php b/src/Plugin/RulesExpression/ActionSetExpression.php
index e4ca4b4f..5b401457 100644
--- a/src/Plugin/RulesExpression/ActionSetExpression.php
+++ b/src/Plugin/RulesExpression/ActionSetExpression.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\rules\Plugin\RulesExpression;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ActionExpressionContainer;
-use Drupal\rules\Engine\ExecutionStateInterface;
 
 /**
  * Holds a set of actions and executes all of them.
diff --git a/src/Plugin/RulesExpression/AndExpression.php b/src/Plugin/RulesExpression/AndExpression.php
index d3d5ac9b..366ecad5 100644
--- a/src/Plugin/RulesExpression/AndExpression.php
+++ b/src/Plugin/RulesExpression/AndExpression.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\rules\Plugin\RulesExpression;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionContainer;
-use Drupal\rules\Engine\ExecutionStateInterface;
 
 /**
  * Evaluates a group of conditions with a logical AND.
diff --git a/src/Plugin/RulesExpression/ConditionExpression.php b/src/Plugin/RulesExpression/ConditionExpression.php
index 0098cbd7..2a011bfb 100644
--- a/src/Plugin/RulesExpression/ConditionExpression.php
+++ b/src/Plugin/RulesExpression/ConditionExpression.php
@@ -5,10 +5,10 @@ namespace Drupal\rules\Plugin\RulesExpression;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\rules\Context\DataProcessorManager;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Core\ConditionManager;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\ExpressionBase;
 use Drupal\rules\Engine\ExpressionInterface;
 use Drupal\rules\Context\ContextHandlerIntegrityTrait;
diff --git a/src/Plugin/RulesExpression/LoopExpression.php b/src/Plugin/RulesExpression/LoopExpression.php
index ea6782d0..aa747864 100644
--- a/src/Plugin/RulesExpression/LoopExpression.php
+++ b/src/Plugin/RulesExpression/LoopExpression.php
@@ -3,9 +3,9 @@
 namespace Drupal\rules\Plugin\RulesExpression;
 
 use Drupal\Core\TypedData\ListDataDefinitionInterface;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ActionExpressionContainer;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\IntegrityViolationList;
 use Drupal\rules\Exception\IntegrityException;
 
diff --git a/src/Plugin/RulesExpression/OrExpression.php b/src/Plugin/RulesExpression/OrExpression.php
index b1a2a1b7..0be90968 100644
--- a/src/Plugin/RulesExpression/OrExpression.php
+++ b/src/Plugin/RulesExpression/OrExpression.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\rules\Plugin\RulesExpression;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionContainer;
-use Drupal\rules\Engine\ExecutionStateInterface;
 
 /**
  * Evaluates a group of conditions with a logical OR.
diff --git a/src/Plugin/RulesExpression/RuleExpression.php b/src/Plugin/RulesExpression/RuleExpression.php
index 3b181ce9..4684f799 100644
--- a/src/Plugin/RulesExpression/RuleExpression.php
+++ b/src/Plugin/RulesExpression/RuleExpression.php
@@ -5,12 +5,12 @@ namespace Drupal\rules\Plugin\RulesExpression;
 use Drupal\Core\Logger\LoggerChannelInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\rules\Context\ContextConfig;
+use Drupal\rules\Context\ExecutionMetadataStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ActionExpressionContainerInterface;
 use Drupal\rules\Engine\ActionExpressionInterface;
 use Drupal\rules\Engine\ConditionExpressionContainerInterface;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionMetadataStateInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\ExpressionBase;
 use Drupal\rules\Engine\ExpressionInterface;
 use Drupal\rules\Engine\ExpressionManagerInterface;
diff --git a/tests/src/Kernel/RulesEngineTest.php b/tests/src/Kernel/RulesEngineTest.php
index 1a285f0f..dd6627d9 100644
--- a/tests/src/Kernel/RulesEngineTest.php
+++ b/tests/src/Kernel/RulesEngineTest.php
@@ -5,8 +5,8 @@ namespace Drupal\Tests\rules\Kernel;
 use Drupal\rules\Core\ConditionManager;
 use Drupal\rules\Context\ContextConfig;
 use Drupal\rules\Context\ContextDefinition;
+use Drupal\rules\Context\ExecutionState;
 use Drupal\rules\Engine\RulesComponent;
-use Drupal\rules\Engine\ExecutionState;
 
 /**
  * Test using the Rules API to create and evaluate rules.
diff --git a/tests/src/Unit/ActionSetExpressionTest.php b/tests/src/Unit/ActionSetExpressionTest.php
index 0c899a35..cccd934c 100644
--- a/tests/src/Unit/ActionSetExpressionTest.php
+++ b/tests/src/Unit/ActionSetExpressionTest.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\Tests\rules\Unit;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ActionExpressionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Plugin\RulesExpression\ActionSetExpression;
 use Drupal\rules\Plugin\RulesExpression\ActionExpression;
 use Prophecy\Argument;
diff --git a/tests/src/Unit/AndExpressionTest.php b/tests/src/Unit/AndExpressionTest.php
index 6867027b..11918b8d 100644
--- a/tests/src/Unit/AndExpressionTest.php
+++ b/tests/src/Unit/AndExpressionTest.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\Tests\rules\Unit;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Plugin\RulesExpression\AndExpression;
 use Prophecy\Argument;
 
diff --git a/tests/src/Unit/ConditionExpressionTest.php b/tests/src/Unit/ConditionExpressionTest.php
index ac347684..7fa70eab 100644
--- a/tests/src/Unit/ConditionExpressionTest.php
+++ b/tests/src/Unit/ConditionExpressionTest.php
@@ -8,9 +8,9 @@ use Drupal\Tests\UnitTestCase;
 use Drupal\rules\Context\DataProcessorInterface;
 use Drupal\rules\Context\ContextConfig;
 use Drupal\rules\Context\DataProcessorManager;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Core\ConditionManager;
 use Drupal\rules\Core\RulesConditionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Plugin\RulesExpression\ConditionExpression;
 use Prophecy\Argument;
 
diff --git a/tests/src/Unit/ContextHandlerTraitTest.php b/tests/src/Unit/ContextHandlerTraitTest.php
index 1ae881ca..77f38a06 100644
--- a/tests/src/Unit/ContextHandlerTraitTest.php
+++ b/tests/src/Unit/ContextHandlerTraitTest.php
@@ -6,7 +6,7 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface;
 use Drupal\rules\Context\ContextConfig;
 use Drupal\rules\Context\ContextDefinitionInterface;
 use Drupal\rules\Context\ContextHandlerTrait;
-use Drupal\rules\Engine\ExecutionStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 
 /**
  * @coversDefaultClass \Drupal\rules\Context\ContextHandlerTrait
diff --git a/tests/src/Unit/Integration/Engine/PrepareExecutionMetadataStateTest.php b/tests/src/Unit/Integration/Engine/PrepareExecutionMetadataStateTest.php
index 3a9a8094..58e88c00 100644
--- a/tests/src/Unit/Integration/Engine/PrepareExecutionMetadataStateTest.php
+++ b/tests/src/Unit/Integration/Engine/PrepareExecutionMetadataStateTest.php
@@ -4,7 +4,7 @@ namespace Drupal\Tests\rules\Unit\Integration\Engine;
 
 use Drupal\rules\Context\ContextConfig;
 use Drupal\rules\Context\ContextDefinition;
-use Drupal\rules\Engine\ExecutionMetadataState;
+use Drupal\rules\Context\ExecutionMetadataState;
 use Drupal\rules\Engine\RulesComponent;
 use Drupal\Tests\rules\Unit\Integration\RulesEntityIntegrationTestBase;
 
diff --git a/tests/src/Unit/Integration/Engine/RulesComponentTest.php b/tests/src/Unit/Integration/Engine/RulesComponentTest.php
index 2394ddce..d3c4bb94 100644
--- a/tests/src/Unit/Integration/Engine/RulesComponentTest.php
+++ b/tests/src/Unit/Integration/Engine/RulesComponentTest.php
@@ -5,7 +5,7 @@ namespace Drupal\Tests\rules\Unit\Integration\Engine;
 use Drupal\rules\Context\ContextConfig;
 use Drupal\rules\Context\ContextDefinition;
 use Drupal\rules\Engine\RulesComponent;
-use Drupal\rules\Engine\ExecutionStateInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\Tests\rules\Unit\Integration\RulesIntegrationTestBase;
 
 /**
diff --git a/tests/src/Unit/OrExpressionTest.php b/tests/src/Unit/OrExpressionTest.php
index 2e6b602c..2a4b0c9c 100644
--- a/tests/src/Unit/OrExpressionTest.php
+++ b/tests/src/Unit/OrExpressionTest.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\Tests\rules\Unit;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Plugin\RulesExpression\OrExpression;
 use Prophecy\Argument;
 
diff --git a/tests/src/Unit/RuleExpressionTest.php b/tests/src/Unit/RuleExpressionTest.php
index 17c2636e..84a4a859 100644
--- a/tests/src/Unit/RuleExpressionTest.php
+++ b/tests/src/Unit/RuleExpressionTest.php
@@ -2,8 +2,8 @@
 
 namespace Drupal\Tests\rules\Unit;
 
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\ExpressionManagerInterface;
 use Drupal\rules\Plugin\RulesExpression\ActionSetExpression;
 use Drupal\rules\Plugin\RulesExpression\RuleExpression;
diff --git a/tests/src/Unit/RulesConditionContainerTest.php b/tests/src/Unit/RulesConditionContainerTest.php
index aed08326..4a23b1b1 100644
--- a/tests/src/Unit/RulesConditionContainerTest.php
+++ b/tests/src/Unit/RulesConditionContainerTest.php
@@ -3,9 +3,9 @@
 namespace Drupal\Tests\rules\Unit;
 
 use Drupal\Core\Logger\LoggerChannelInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ConditionExpressionContainer;
 use Drupal\rules\Engine\ExpressionManagerInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 
 /**
  * @coversDefaultClass \Drupal\rules\Engine\ConditionExpressionContainer
diff --git a/tests/src/Unit/RulesUnitTestBase.php b/tests/src/Unit/RulesUnitTestBase.php
index 52f602a4..bfb4cfde 100644
--- a/tests/src/Unit/RulesUnitTestBase.php
+++ b/tests/src/Unit/RulesUnitTestBase.php
@@ -3,9 +3,9 @@
 namespace Drupal\Tests\rules\Unit;
 
 use Drupal\Core\Logger\LoggerChannelInterface;
+use Drupal\rules\Context\ExecutionStateInterface;
 use Drupal\rules\Engine\ActionExpressionInterface;
 use Drupal\rules\Engine\ConditionExpressionInterface;
-use Drupal\rules\Engine\ExecutionStateInterface;
 use Drupal\rules\Engine\ExpressionManagerInterface;
 use Drupal\Tests\UnitTestCase;
 use Prophecy\Argument;
-- 
GitLab