diff --git a/src/Context/ContextConfig.php b/src/Context/ContextConfig.php index c2f499f8cd05bc4b943815708053320546301ac5..b0748c9981e7c822f0ed673e8501cda60d065a1f 100644 --- a/src/Context/ContextConfig.php +++ b/src/Context/ContextConfig.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Context; use Drupal\Core\Plugin\ContextAwarePluginInterface as CoreContextAwarePluginInterface; +use Drupal\rules\Exception\LogicException; /** * Class for value objects helping with context configuration. @@ -55,7 +56,7 @@ class ContextConfig { * @param string $property_path * A valid property path; e.g., "node.uid.target_id". * - * @throws \LogicException + * @throws \Drupal\rules\Exception\LogicException * Thrown if a context value and map are set for a given context at the same * time. * @@ -63,7 +64,7 @@ class ContextConfig { */ public function map($context_name, $property_path) { if (isset($this->config['context_values'][$context_name])) { - throw new \LogicException("Cannot map a context value and pre-define it at the same time."); + throw new LogicException("Cannot map a context value and pre-define it at the same time."); } $this->config['context_mapping'][$context_name] = $property_path; return $this; @@ -79,7 +80,7 @@ class ContextConfig { * context's data type, unless a data processor takes care of processing it * to a valid value. * - * @throws \LogicException + * @throws \Drupal\rules\Exception\LogicException * Thrown if a context value and map are set for a given context at the same * time. * @@ -87,7 +88,7 @@ class ContextConfig { */ public function setValue($context_name, $value) { if (isset($this->config['context_mapping'][$context_name])) { - throw new \LogicException("Cannot map a context value and pre-define it at the same time."); + throw new LogicException("Cannot map a context value and pre-define it at the same time."); } $this->config['context_values'][$context_name] = $value; return $this; diff --git a/src/Context/ContextDefinition.php b/src/Context/ContextDefinition.php index 1ff4d44a3fd82866ffa0b6106c71f58700ada86e..527a44820ccb5d7044667080edb33464ddbf8824 100644 --- a/src/Context/ContextDefinition.php +++ b/src/Context/ContextDefinition.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Context; use \Drupal\Core\Plugin\Context\ContextDefinition as ContextDefinitionCore; +use \Drupal\Component\Plugin\Exception\ContextException; /** * Extends the core context definition class with useful methods. @@ -65,10 +66,13 @@ class ContextDefinition extends ContextDefinitionCore implements ContextDefiniti * * @return static * The created definition. + * + * @throws \Drupal\Component\Plugin\Exception\ContextException + * If the required classes are not implemented. */ public static function createFromArray($values) { if (isset($values['class']) && !in_array(ContextDefinitionInterface::class, class_implements($values['class']))) { - throw new \Exception('ContextDefinition class must implement ' . ContextDefinitionInterface::class . '.'); + throw new ContextException('ContextDefinition class must implement ' . ContextDefinitionInterface::class . '.'); } // Default to Rules context definition class. $values['class'] = isset($values['class']) ? $values['class'] : ContextDefinition::class; diff --git a/src/Context/ContextHandlerIntegrityTrait.php b/src/Context/ContextHandlerIntegrityTrait.php index 4a0aba227828fcb4b173f3cf195682a953529d18..84a61893427fbca011a925e2ca77d75ddb5a7e82 100644 --- a/src/Context/ContextHandlerIntegrityTrait.php +++ b/src/Context/ContextHandlerIntegrityTrait.php @@ -7,11 +7,12 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface as CoreContextAwarePluginInte use Drupal\Core\TypedData\DataDefinitionInterface; //@codingStandardsIgnoreStart use Drupal\rules\Context\ContextDefinitionInterface as RulesContextDefinitionInterface; +use Drupal\rules\Context\ContextProviderInterface; +use Drupal\rules\Exception\IntegrityException; //@codingStandardsIgnoreEnd use Drupal\rules\Engine\ExecutionMetadataStateInterface; use Drupal\rules\Engine\IntegrityViolation; use Drupal\rules\Engine\IntegrityViolationList; -use Drupal\rules\Exception\RulesIntegrityException; /** * Extends the context handler trait with support for checking integrity. @@ -47,7 +48,7 @@ trait ContextHandlerIntegrityTrait { $data_definition = $this->getMappedDefinition($name, $metadata_state); $this->checkDataTypeCompatible($context_definition, $data_definition, $name, $violation_list); } - catch (RulesIntegrityException $e) { + catch (IntegrityException $e) { $violation = new IntegrityViolation(); $violation->setMessage($this->t('Data selector %selector for context %context_name is invalid. @message', [ '%selector' => $this->configuration['context_mapping'][$name], diff --git a/src/Context/ContextHandlerTrait.php b/src/Context/ContextHandlerTrait.php index 3f049d6ba2a43b302a887f9ab2cea70a1ac70370..9e8e4fd4cc0c06ec2fd84488ee0660f93186395f 100644 --- a/src/Context/ContextHandlerTrait.php +++ b/src/Context/ContextHandlerTrait.php @@ -6,8 +6,8 @@ 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\RulesEvaluationException; -use Drupal\rules\Exception\RulesIntegrityException; +use Drupal\rules\Exception\EvaluationException; +use Drupal\rules\Exception\IntegrityException; /** * Provides methods for handling context based on the plugin configuration. @@ -41,7 +41,7 @@ trait ContextHandlerTrait { * @param \Drupal\rules\Engine\ExecutionStateInterface $state * The execution state containing available variables. * - * @throws \Drupal\rules\Exception\RulesEvaluationException + * @throws \Drupal\rules\Exception\EvaluationException * Thrown if some context is not satisfied; e.g. a required context is * missing. * @@ -76,7 +76,7 @@ trait ContextHandlerTrait { } catch (ContextException $e) { if (strpos($e->getMessage(), 'context is required') === FALSE) { - throw new RulesEvaluationException($e->getMessage()); + throw new EvaluationException($e->getMessage()); } } } @@ -91,11 +91,11 @@ trait ContextHandlerTrait { // but valid (e.g. a reference on an empty property). In that case // isAllowedNull determines whether the context is conform. if (!isset($this->configuration['context_mapping'][$name])) { - throw new RulesEvaluationException("Required context $name is missing for plugin " + throw new EvaluationException("Required context $name is missing for plugin " . $plugin->getPluginId() . '.'); } elseif (!$definition->isAllowedNull()) { - throw new RulesEvaluationException("The context for $name is NULL, but the context $name in " + throw new EvaluationException("The context for $name is NULL, but the context $name in " . $plugin->getPluginId() . ' requires a value.'); } } @@ -164,7 +164,7 @@ trait ContextHandlerTrait { try { $selected_data[$name] = $this->getMappedDefinition($name, $metadata_state); } - catch (RulesIntegrityException $e) { + catch (IntegrityException $e) { // Ignore invalid data selectors here, such that context gets refined // as far as possible still and can be respected by the UI when fixing // broken selectors. @@ -186,7 +186,7 @@ trait ContextHandlerTrait { * A data definition if the property path could be applied, or NULL if the * context is not mapped. * - * @throws \Drupal\rules\Exception\RulesIntegrityException + * @throws \Drupal\rules\Exception\IntegrityException * Thrown if the data selector that is configured for the context is * invalid. */ diff --git a/src/Context/DataProcessorInterface.php b/src/Context/DataProcessorInterface.php index 31526f62e438de597baa6d468d7860d7de0378d7..0fab75a11217e5815e513775674b8f55a98d2ea3 100644 --- a/src/Context/DataProcessorInterface.php +++ b/src/Context/DataProcessorInterface.php @@ -21,7 +21,7 @@ interface DataProcessorInterface { * The processed value. Since the value can also be a primitive data type * (a string for example) this function must return the value. * - * @throws \Drupal\rules\Exception\RulesEvaluationException + * @throws \Drupal\rules\Exception\EvaluationException * Thrown when the data cannot be processed. */ public function process($value, ExecutionStateInterface $rules_state); diff --git a/src/Core/ExecutablePluginTrait.php b/src/Core/ExecutablePluginTrait.php index c3e4fa3a8bf555c711778eaae7584a83c02f9324..d0c5c1795bdc77fe885b35574f29250f1b62bacf 100644 --- a/src/Core/ExecutablePluginTrait.php +++ b/src/Core/ExecutablePluginTrait.php @@ -12,11 +12,11 @@ trait ExecutablePluginTrait { /** * Get the translated label from the plugin definition. * - * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException - * Thrown if the label is not defined for the plugin. - * * @return string * The label of the plugin. + * + * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException + * Thrown if the label is not defined for the plugin. */ protected function getLabelValue() { $definition = $this->getPluginDefinition(); @@ -32,11 +32,11 @@ trait ExecutablePluginTrait { /** * Get the translated summary from the label annotation. * - * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException - * Thrown if a summary was not set. - * * @return string * The summary of the plugin. + * + * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException + * Thrown if a summary was not set. */ public function summary() { return $this->getLabelValue(); diff --git a/src/Engine/ExecutionMetadataState.php b/src/Engine/ExecutionMetadataState.php index b060da27a1e34303c0c6d5681b33be3b187e5671..87800d1792a650b7c7999ba6977398032485e3dd 100644 --- a/src/Engine/ExecutionMetadataState.php +++ b/src/Engine/ExecutionMetadataState.php @@ -5,7 +5,8 @@ namespace Drupal\rules\Engine; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\rules\Context\GlobalContextRepositoryTrait; -use Drupal\rules\Exception\RulesIntegrityException; +use Drupal\rules\Exception\IntegrityException; +use Drupal\rules\Exception\InvalidArgumentException; use Drupal\rules\TypedData\DataFetcherTrait; /** @@ -61,7 +62,7 @@ class ExecutionMetadataState implements ExecutionMetadataStateInterface { */ public function getDataDefinition($name) { if (!array_key_exists($name, $this->dataDefinitions)) { - throw new RulesIntegrityException("Unable to get variable $name, it is not defined."); + throw new IntegrityException("Unable to get variable $name, it is not defined."); } return $this->dataDefinitions[$name]; } @@ -102,9 +103,9 @@ class ExecutionMetadataState implements ExecutionMetadataStateInterface { ->getDataFetcher() ->fetchDefinitionBySubPaths($this->getDataDefinition($var_name), $parts, $langcode); } - catch (\InvalidArgumentException $e) { + catch (InvalidArgumentException $e) { // Pass on the original exception in the exception trace. - throw new RulesIntegrityException($e->getMessage(), 0, $e); + throw new IntegrityException($e->getMessage(), 0, $e); } } diff --git a/src/Engine/ExecutionMetadataStateInterface.php b/src/Engine/ExecutionMetadataStateInterface.php index 3b36a95c3e7a770a94d52bd7aa8e83da78fce6c4..f850a6e308dd895189707129e2d76ed37a012b00 100644 --- a/src/Engine/ExecutionMetadataStateInterface.php +++ b/src/Engine/ExecutionMetadataStateInterface.php @@ -79,7 +79,7 @@ interface ExecutionMetadataStateInterface { * @return \Drupal\Core\TypedData\DataDefinitionInterface * A data definition if the property path could be applied. * - * @throws \Drupal\rules\Exception\RulesIntegrityException + * @throws \Drupal\rules\Exception\IntegrityException * Thrown if the property path is invalid. */ public function fetchDefinitionByPropertyPath($property_path, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED); diff --git a/src/Engine/ExecutionState.php b/src/Engine/ExecutionState.php index 30a92f1dfd311e0d2d0f1ddaf2a530af299cf217..e7e2738a198c8c4f1f4ed0f1c6865144e81adbe7 100644 --- a/src/Engine/ExecutionState.php +++ b/src/Engine/ExecutionState.php @@ -7,7 +7,8 @@ use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\TypedData\TypedDataTrait; use Drupal\rules\Context\ContextDefinitionInterface; use Drupal\rules\Context\GlobalContextRepositoryTrait; -use Drupal\rules\Exception\RulesEvaluationException; +use Drupal\rules\Exception\EvaluationException; +use Drupal\rules\Exception\InvalidArgumentException; use Drupal\rules\TypedData\DataFetcherTrait; /** @@ -95,7 +96,7 @@ class ExecutionState implements ExecutionStateInterface { */ public function getVariable($name) { if (!$this->hasVariable($name)) { - throw new RulesEvaluationException("Unable to get variable $name, it is not defined."); + throw new EvaluationException("Unable to get variable $name, it is not defined."); } return $this->variables[$name]; } @@ -155,13 +156,13 @@ class ExecutionState implements ExecutionStateInterface { ->getDataFetcher() ->fetchDataBySubPaths($this->getVariable($var_name), $parts, $langcode); } - catch (\InvalidArgumentException $e) { + catch (InvalidArgumentException $e) { // Pass on the original exception in the exception trace. - throw new RulesEvaluationException($e->getMessage(), 0, $e); + throw new EvaluationException($e->getMessage(), 0, $e); } catch (MissingDataException $e) { // Pass on the original exception in the exception trace. - throw new RulesEvaluationException($e->getMessage(), 0, $e); + throw new EvaluationException($e->getMessage(), 0, $e); } } diff --git a/src/Engine/ExecutionStateInterface.php b/src/Engine/ExecutionStateInterface.php index 26bb4dad19e10789cf34a6f581b1e082b0fea1dc..5a2d411aa2de3e3ee2a0ace8ed18a51e05061a6b 100644 --- a/src/Engine/ExecutionStateInterface.php +++ b/src/Engine/ExecutionStateInterface.php @@ -45,8 +45,8 @@ interface ExecutionStateInterface { * @return \Drupal\Core\TypedData\TypedDataInterface * The variable wrapped as typed data. * - * @throws \Drupal\rules\Exception\RulesEvaluationException - * Throws a RulesEvaluationException if the variable does not exist in the + * @throws \Drupal\rules\Exception\EvaluationException + * Throws an EvaluationException if the variable does not exist in the * state. */ public function getVariable($name); @@ -60,8 +60,8 @@ interface ExecutionStateInterface { * @return mixed * The variable value. * - * @throws \Drupal\rules\Exception\RulesEvaluationException - * Throws a RulesEvaluationException if the variable does not exist in the + * @throws \Drupal\rules\Exception\EvaluationException + * Throws an EvaluationException if the variable does not exist in the * state. */ public function getVariableValue($name); @@ -100,8 +100,8 @@ interface ExecutionStateInterface { * @return \Drupal\Core\TypedData\TypedDataInterface * The variable wrapped as typed data. * - * @throws \Drupal\rules\Exception\RulesEvaluationException - * Throws a RulesEvaluationException in case the selector cannot be applied. + * @throws \Drupal\rules\Exception\EvaluationException + * Throws an EvaluationException in case the selector cannot be applied. */ public function fetchDataByPropertyPath($property_path, $langcode = NULL); diff --git a/src/Engine/ExpressionInterface.php b/src/Engine/ExpressionInterface.php index 89daff48343789a0a9fd88656ec0d14a8592fd76..a3c43b608a47ee8759f2ae98fddcf206fcd9e0cf 100644 --- a/src/Engine/ExpressionInterface.php +++ b/src/Engine/ExpressionInterface.php @@ -25,7 +25,7 @@ interface ExpressionInterface extends ExecutableInterface, ConfigurablePluginInt * The expression may return a boolean value after execution, this is used * by conditions that return their evaluation result. * - * @throws \Drupal\rules\Exception\RulesEvaluationException + * @throws \Drupal\rules\Exception\EvaluationException * Thrown if the Rules expression triggers errors during execution. */ public function executeWithState(ExecutionStateInterface $state); diff --git a/src/Engine/IntegrityViolationList.php b/src/Engine/IntegrityViolationList.php index 241ff0907050dbfa7bf6c9809222f2d5a6fa61c0..e08cf89a20c0a455cb82e1086abf01589f2ee721 100644 --- a/src/Engine/IntegrityViolationList.php +++ b/src/Engine/IntegrityViolationList.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Engine; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\rules\Exception\OutOfBoundsException; /** * Collection of integrity violations. @@ -34,11 +35,16 @@ class IntegrityViolationList extends \ArrayIterator { * @return \Drupal\rules\Engine\IntegrityViolationInterface * The violation. * - * @throws \OutOfBoundsException + * @throws \Drupal\rules\Exception\OutOfBoundsException * Thrown if the offset does not exist. */ public function get($offset) { - return $this->offsetGet($offset); + try { + return $this->offsetGet($offset); + } + catch (\OutOfBoundsException $e) { + throw new OutOfBoundsException(); + } } /** diff --git a/src/Engine/RulesComponent.php b/src/Engine/RulesComponent.php index c8ed4fd741a9116b5aa95ba0ece0b086b390f4b9..aed6dd128cf060b4937f1cba28a14bc9a5be0866 100644 --- a/src/Engine/RulesComponent.php +++ b/src/Engine/RulesComponent.php @@ -5,6 +5,7 @@ namespace Drupal\rules\Engine; use Drupal\Core\Entity\DependencyTrait; use Drupal\rules\Context\ContextDefinition; use Drupal\rules\Context\ContextDefinitionInterface; +use Drupal\rules\Exception\LogicException; /** * Handles executable Rules components. @@ -208,14 +209,14 @@ class RulesComponent { * @param mixed $value * The context value. * - * @throws \LogicException - * Thrown if the passed context is not defined. - * * @return $this + * + * @throws \Drupal\rules\Exception\LogicException + * Thrown if the passed context is not defined. */ public function setContextValue($name, $value) { if (!isset($this->contextDefinitions[$name])) { - throw new \LogicException("The specified context '$name' is not defined."); + throw new LogicException("The specified context '$name' is not defined."); } $this->state->setVariable($name, $this->contextDefinitions[$name], $value); return $this; @@ -227,7 +228,7 @@ class RulesComponent { * @return mixed[] * The array of provided context values, keyed by context name. * - * @throws \Drupal\rules\Exception\RulesEvaluationException + * @throws \Drupal\rules\Exception\EvaluationException * Thrown if the Rules expression triggers errors during execution. */ public function execute() { @@ -250,9 +251,9 @@ class RulesComponent { * @return mixed[] * The array of provided context values, keyed by context name. * - * @throws \LogicException + * @throws \Drupal\rules\Exception\LogicException * Thrown if the context is not defined. - * @throws \Drupal\rules\Exception\RulesEvaluationException + * @throws \Drupal\rules\Exception\EvaluationException * Thrown if the Rules expression triggers errors during execution. */ public function executeWithArguments(array $arguments) { diff --git a/src/Engine/RulesComponentRepository.php b/src/Engine/RulesComponentRepository.php index 4b2be8516cc9e7d10bbdcf74a38f6727b2438621..f89a851f52ad64257b39dedaa7cd3be58a349ea1 100644 --- a/src/Engine/RulesComponentRepository.php +++ b/src/Engine/RulesComponentRepository.php @@ -4,7 +4,7 @@ namespace Drupal\rules\Engine; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Language\LanguageManagerInterface; -use \InvalidArgumentException; +use Drupal\rules\Exception\InvalidArgumentException; /** * Implements the component repository interface. diff --git a/src/Engine/RulesComponentRepositoryInterface.php b/src/Engine/RulesComponentRepositoryInterface.php index d9e278ab83f3aecccb4f4b21fc61411e3f35999e..7f21f1a1da2cffe456f3741b19f853963a3b9a1e 100644 --- a/src/Engine/RulesComponentRepositoryInterface.php +++ b/src/Engine/RulesComponentRepositoryInterface.php @@ -42,7 +42,7 @@ interface RulesComponentRepositoryInterface { * @return \Drupal\rules\Engine\RulesComponent|null * The component, or NULL if it is not existing. * - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if an unsupported provider is given. */ public function get($id, $resolver = 'rules_component'); @@ -61,7 +61,7 @@ interface RulesComponentRepositoryInterface { * @return \Drupal\rules\Engine\RulesComponent[] * An array of components, keyed by component ID. * - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if an unsupported provider is given. */ public function getMultiple(array $ids, $resolver = 'rules_component'); diff --git a/src/Exception/RulesEvaluationException.php b/src/Exception/EvaluationException.php similarity index 64% rename from src/Exception/RulesEvaluationException.php rename to src/Exception/EvaluationException.php index 9add082003d4bad038a815e59ade40299e6f7021..50adc71101d9940cb6ab3b6daa5e7368924ace56 100644 --- a/src/Exception/RulesEvaluationException.php +++ b/src/Exception/EvaluationException.php @@ -5,6 +5,6 @@ namespace Drupal\rules\Exception; /** * An exception that is thrown during evaluation. */ -class RulesEvaluationException extends RulesException { +class EvaluationException extends RulesException { } diff --git a/src/Exception/RulesIntegrityException.php b/src/Exception/IntegrityException.php similarity index 70% rename from src/Exception/RulesIntegrityException.php rename to src/Exception/IntegrityException.php index 511ab9998ab7e7321d364cf913b231c90d3382b1..64f0d16e4bd3cadcd5ca62abce7ba97956ccb5b6 100644 --- a/src/Exception/RulesIntegrityException.php +++ b/src/Exception/IntegrityException.php @@ -5,6 +5,6 @@ namespace Drupal\rules\Exception; /** * An exception that is thrown during integrity checks at configuration time. */ -class RulesIntegrityException extends RulesException { +class IntegrityException extends RulesException { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php new file mode 100644 index 0000000000000000000000000000000000000000..6c8b7df1c988b12daac442267501fe08c135d59e --- /dev/null +++ b/src/Exception/InvalidArgumentException.php @@ -0,0 +1,10 @@ +<?php + +namespace Drupal\rules\Exception; + +/** + * An exception that is thrown if an argument is invalid. + */ +class InvalidArgumentException extends RulesException { + +} diff --git a/src/Exception/LogicException.php b/src/Exception/LogicException.php new file mode 100644 index 0000000000000000000000000000000000000000..06954f5d25e35a4b5368de9476bc26a34646474a --- /dev/null +++ b/src/Exception/LogicException.php @@ -0,0 +1,10 @@ +<?php + +namespace Drupal\rules\Exception; + +/** + * An exception that is thrown when there is an error in program logic. + */ +class LogicException extends RulesException { + +} diff --git a/src/Exception/OutOfBoundsException.php b/src/Exception/OutOfBoundsException.php new file mode 100644 index 0000000000000000000000000000000000000000..c118b4ec1aaf9e10c427c34f4117410dee1746bf --- /dev/null +++ b/src/Exception/OutOfBoundsException.php @@ -0,0 +1,10 @@ +<?php + +namespace Drupal\rules\Exception; + +/** + * An Exception that is thrown if a value is not a valid key. + */ +class OutOfBoundsException extends RulesException { + +} diff --git a/src/Form/AddExpressionForm.php b/src/Form/AddExpressionForm.php index 07808f43e0f80c4bf61f2869ae7050a2aa5a77a3..2f98fd1805152928e73e3dcdbc753f4f38121462 100644 --- a/src/Form/AddExpressionForm.php +++ b/src/Form/AddExpressionForm.php @@ -7,6 +7,7 @@ use Drupal\rules\Ui\RulesUiHandlerInterface; use Drupal\rules\Engine\ExpressionContainerInterface; use Drupal\rules\Engine\ExpressionManagerInterface; use Drupal\rules\Engine\RulesComponent; +use Drupal\rules\Exception\LogicException; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -70,7 +71,7 @@ class AddExpressionForm extends EditExpressionForm { protected function getEditedExpression(RulesComponent $component) { $component_expression = $component->getExpression(); if (!$component_expression instanceof ExpressionContainerInterface) { - throw new \LogicException('Cannot add expression to expression of type ' . $component_expression->getPluginId()); + throw new LogicException('Cannot add expression to expression of type ' . $component_expression->getPluginId()); } if ($this->uuid && $expression = $component_expression->getExpression($this->uuid)) { return $expression; diff --git a/src/Plugin/Condition/UserHasRole.php b/src/Plugin/Condition/UserHasRole.php index bcdff8820555e107c144771f5bccfc0b64805418..46c11660b6e966cb44442bdafb77e9313f39ba68 100644 --- a/src/Plugin/Condition/UserHasRole.php +++ b/src/Plugin/Condition/UserHasRole.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Plugin\Condition; use Drupal\rules\Core\RulesConditionBase; +use Drupal\rules\Exception\InvalidArgumentException; use Drupal\user\UserInterface; /** @@ -62,7 +63,7 @@ class UserHasRole extends RulesConditionBase { return (bool) !array_diff($rids, $account->getRoles()); default: - throw new \InvalidArgumentException('Either use "AND" or "OR". Leave empty for default "AND" behavior.'); + throw new InvalidArgumentException('Either use "AND" or "OR". Leave empty for default "AND" behavior.'); } } diff --git a/src/Plugin/RulesAction/DataConvert.php b/src/Plugin/RulesAction/DataConvert.php index 5d1ee5467a482e2d592be0b7fc7bb8e1de36435f..28cf2dc67f4eeb1d83a71daf50b523c571b18600 100644 --- a/src/Plugin/RulesAction/DataConvert.php +++ b/src/Plugin/RulesAction/DataConvert.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Plugin\RulesAction; use Drupal\rules\Core\RulesActionBase; +use Drupal\rules\Exception\InvalidArgumentException; /** * @RulesAction( @@ -49,12 +50,12 @@ class DataConvert extends RulesActionBase { protected function doExecute($value, $target_type, $rounding_behavior) { // @todo: Add support for objects implementing __toString(). if (!is_scalar($value)) { - throw new \InvalidArgumentException('Only scalar values are supported.'); + throw new InvalidArgumentException('Only scalar values are supported.'); } // Ensure valid contexts have been provided. if (isset($rounding_behavior) && $target_type != 'integer') { - throw new \InvalidArgumentException('A rounding behavior only makes sense with an integer target type.'); + throw new InvalidArgumentException('A rounding behavior only makes sense with an integer target type.'); } // First apply the rounding behavior if given. @@ -73,7 +74,7 @@ class DataConvert extends RulesActionBase { break; default: - throw new \InvalidArgumentException("Unknown rounding behavior: $rounding_behavior"); + throw new InvalidArgumentException("Unknown rounding behavior: $rounding_behavior"); } } @@ -91,7 +92,7 @@ class DataConvert extends RulesActionBase { break; default: - throw new \InvalidArgumentException("Unknown target type: $target_type"); + throw new InvalidArgumentException("Unknown target type: $target_type"); } $this->setProvidedValue('conversion_result', $result); diff --git a/src/Plugin/RulesAction/UserRoleAdd.php b/src/Plugin/RulesAction/UserRoleAdd.php index 48471a25acc527794efa2f5417b9acf34d4246c8..7cfc0a1f7cedc0e7e93bab8b994c7e910618c478 100644 --- a/src/Plugin/RulesAction/UserRoleAdd.php +++ b/src/Plugin/RulesAction/UserRoleAdd.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Plugin\RulesAction; use Drupal\rules\Core\RulesActionBase; +use Drupal\rules\Exception\InvalidArgumentException; use Drupal\user\UserInterface; /** @@ -42,6 +43,8 @@ class UserRoleAdd extends RulesActionBase { * User object. * @param \Drupal\user\RoleInterface[] $roles * Array of UserRoles to assign. + * + * @throws \Drupal\rules\Exception\InvalidArgumentException */ protected function doExecute(UserInterface $account, array $roles) { foreach ($roles as $role) { @@ -50,7 +53,12 @@ class UserRoleAdd extends RulesActionBase { // If you try to add anonymous or authenticated role to user, Drupal // will throw an \InvalidArgumentException. Anonymous or authenticated // role ID must not be assigned manually. - $account->addRole($role->id()); + try { + $account->addRole($role->id()); + } + catch (\InvalidArgumentException $e) { + throw new InvalidArgumentException($e->getMessage()); + } // Set flag that indicates if the entity should be auto-saved later. $this->saveLater = TRUE; } diff --git a/src/Plugin/RulesAction/UserRoleRemove.php b/src/Plugin/RulesAction/UserRoleRemove.php index 79b7b2c5c56bd3bd1fb8e583a8d79cd5bd993655..aa03ffe93c6dad5a70a8d652f33982da508174ed 100644 --- a/src/Plugin/RulesAction/UserRoleRemove.php +++ b/src/Plugin/RulesAction/UserRoleRemove.php @@ -4,6 +4,7 @@ namespace Drupal\rules\Plugin\RulesAction; use Drupal\rules\Core\RulesActionBase; use Drupal\user\UserInterface; +use Drupal\rules\Exception\InvalidArgumentException; /** * Provides a 'Remove user role' action. @@ -39,6 +40,8 @@ class UserRoleRemove extends RulesActionBase { * User object the roles should be removed from. * @param \Drupal\user\RoleInterface[] $roles * Array of user roles. + * + * @throws \Drupal\rules\Exception\InvalidArgumentException */ protected function doExecute(UserInterface $account, array $roles) { foreach ($roles as $role) { @@ -47,7 +50,12 @@ class UserRoleRemove extends RulesActionBase { // If you try to add anonymous or authenticated role to user, Drupal // will throw an \InvalidArgumentException. Anonymous or authenticated // role ID must not be assigned manually. - $account->removeRole($role->id()); + try { + $account->removeRole($role->id()); + } + catch (\InvalidArgumentException $e) { + throw new InvalidArgumentException($e->getMessage()); + } // Set flag that indicates if the entity should be auto-saved later. $this->saveLater = TRUE; } diff --git a/src/Plugin/RulesExpression/RulesLoop.php b/src/Plugin/RulesExpression/RulesLoop.php index da2a7f052c3ec4a9a7719779aba6218628b11c4a..892eb8618ac397c862ce377c40c37f7e134e1f4c 100644 --- a/src/Plugin/RulesExpression/RulesLoop.php +++ b/src/Plugin/RulesExpression/RulesLoop.php @@ -7,7 +7,7 @@ use Drupal\rules\Engine\ActionExpressionContainer; use Drupal\rules\Engine\ExecutionMetadataStateInterface; use Drupal\rules\Engine\ExecutionStateInterface; use Drupal\rules\Engine\IntegrityViolationList; -use Drupal\rules\Exception\RulesIntegrityException; +use Drupal\rules\Exception\IntegrityException; /** * Holds a set of actions that are executed over the iteration of a list. @@ -61,7 +61,7 @@ class RulesLoop extends ActionExpressionContainer { try { $list_definition = $metadata_state->fetchDefinitionByPropertyPath($this->configuration['list']); } - catch (RulesIntegrityException $e) { + catch (IntegrityException $e) { $violation_list->addViolationWithMessage($this->t('List variable %list does not exist. @message', [ '%list' => $this->configuration['list'], '@message' => $e->getMessage(), @@ -109,7 +109,7 @@ class RulesLoop extends ActionExpressionContainer { $list_item_definition = $list_definition->getItemDefinition(); $metadata_state->setDataDefinition($this->configuration['list_item'], $list_item_definition); } - catch (RulesIntegrityException $e) { + catch (IntegrityException $e) { // Silently eat the exception: we just continue without adding the list // item definition to the state. } diff --git a/src/Plugin/TypedDataFilter/FormatDateFilter.php b/src/Plugin/TypedDataFilter/FormatDateFilter.php index 7d7b84cf5aaea70a06d3946afbb0ae0784a95135..08818ce773632314d780e1e133919f61b444b50f 100644 --- a/src/Plugin/TypedDataFilter/FormatDateFilter.php +++ b/src/Plugin/TypedDataFilter/FormatDateFilter.php @@ -9,6 +9,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\DataDefinitionInterface; use Drupal\Core\TypedData\Type\DateTimeInterface; +use Drupal\rules\Exception\InvalidArgumentException; use Drupal\rules\TypedData\DataFilterBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -77,7 +78,7 @@ class FormatDateFilter extends DataFilterBase implements ContainerFactoryPluginI if ($arguments[0] != 'custom' && $bubbleable_metadata) { $config = $this->dateFormatStorage->load($arguments[0]); if (!$config) { - throw new \InvalidArgumentException("Unknown date format $arguments[0] given."); + throw new InvalidArgumentException("Unknown date format $arguments[0] given."); } $bubbleable_metadata->addCacheableDependency($config); } diff --git a/src/TypedData/DataFetcher.php b/src/TypedData/DataFetcher.php index 6c2a5981ace953e56329165a6c05e6d6a602d955..f6e37992234dde532093ae4d19477dd834f37d36 100644 --- a/src/TypedData/DataFetcher.php +++ b/src/TypedData/DataFetcher.php @@ -17,6 +17,7 @@ use Drupal\Core\TypedData\ListInterface; use Drupal\Core\TypedData\PrimitiveInterface; use Drupal\Core\TypedData\TranslatableInterface; use Drupal\Core\TypedData\TypedDataInterface; +use Drupal\rules\Exception\InvalidArgumentException; /** * Implementation of the data fetcher service. @@ -75,7 +76,7 @@ class DataFetcher implements DataFetcherInterface { } else { $current_selector_string = implode('.', $current_selector); - throw new \InvalidArgumentException("The parent property is not a list or a complex structure at '$current_selector_string'."); + throw new InvalidArgumentException("The parent property is not a list or a complex structure at '$current_selector_string'."); } // If an accessed list item is not existing, $typed_data will be NULL. @@ -96,7 +97,7 @@ class DataFetcher implements DataFetcherInterface { catch (\InvalidArgumentException $e) { $selector = implode('.', $sub_paths); $current_selector = implode('.', $current_selector); - throw new \InvalidArgumentException("Unable to apply data selector '$selector' at '$current_selector': " . $e->getMessage()); + throw new InvalidArgumentException("Unable to apply data selector '$selector' at '$current_selector': " . $e->getMessage()); } } @@ -140,11 +141,11 @@ class DataFetcher implements DataFetcherInterface { $current_selector_string = implode('.', $current_selector); if (count($current_selector) > 1) { $parent_property = $current_selector[count($current_selector) - 2]; - throw new \InvalidArgumentException("The data selector '$current_selector_string' cannot be applied because the parent property '$parent_property' is not a list or a complex structure"); + throw new InvalidArgumentException("The data selector '$current_selector_string' cannot be applied because the parent property '$parent_property' is not a list or a complex structure"); } else { $type = $data_definition->getDataType(); - throw new \InvalidArgumentException("The data selector '$current_selector_string' cannot be applied because the definition of type '$type' is not a list or a complex structure"); + throw new InvalidArgumentException("The data selector '$current_selector_string' cannot be applied because the definition of type '$type' is not a list or a complex structure"); } } @@ -153,7 +154,7 @@ class DataFetcher implements DataFetcherInterface { if (!isset($data_definition)) { $selector_string = implode('.', $sub_paths); $current_selector_string = implode('.', $current_selector); - throw new \InvalidArgumentException("Unable to apply data selector '$selector_string' at '$current_selector_string'"); + throw new InvalidArgumentException("Unable to apply data selector '$selector_string' at '$current_selector_string'"); } } return $data_definition; @@ -196,7 +197,7 @@ class DataFetcher implements DataFetcherInterface { try { $variable_definition = $this->fetchDefinitionByPropertyPath($data_definitions[$first_part], $middle_path); } - catch (\InvalidArgumentException $e) { + catch (InvalidArgumentException $e) { // Invalid property path, so no suggestions available. return []; } diff --git a/src/TypedData/DataFetcherInterface.php b/src/TypedData/DataFetcherInterface.php index fa6a62ac50992cefd3996581c2483e8e9d33c4c9..102264c4ba5349e91d625ae5907438e41e31f40f 100644 --- a/src/TypedData/DataFetcherInterface.php +++ b/src/TypedData/DataFetcherInterface.php @@ -30,7 +30,7 @@ interface DataFetcherInterface { * @throws \Drupal\Core\TypedData\Exception\MissingDataException * Thrown if the data cannot be fetched due to missing data; e.g., unset * properties or list items. - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if the given path is not valid for the given data; e.g., a not * existing property is referenced. */ @@ -53,7 +53,7 @@ interface DataFetcherInterface { * @throws \Drupal\Core\TypedData\Exception\MissingDataException * Thrown if the data cannot be fetched due to missing data; e.g., unset * properties or list items. - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if the given path is not valid for the given data; e.g., a not * existing property is referenced. */ @@ -73,7 +73,7 @@ interface DataFetcherInterface { * @return \Drupal\Core\TypedData\DataDefinitionInterface * The data definition of the target. * - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if the given path is not valid for the given data; e.g., a not * existing property is referenced. */ @@ -93,7 +93,7 @@ interface DataFetcherInterface { * @return \Drupal\Core\TypedData\DataDefinitionInterface * The data definition of the target. * - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if the given path is not valid for the given data; e.g., a not * existing property is referenced. */ diff --git a/src/TypedData/PlaceholderResolver.php b/src/TypedData/PlaceholderResolver.php index cefafe37d9e539d176b3806137c08a25f421fa0a..63fd58bbe7fa24948e2526c19a5d8dc0e65ea631 100644 --- a/src/TypedData/PlaceholderResolver.php +++ b/src/TypedData/PlaceholderResolver.php @@ -6,6 +6,7 @@ use Drupal\Component\Render\HtmlEscapedText; use Drupal\Component\Render\MarkupInterface; use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\TypedData\Exception\MissingDataException; +use Drupal\rules\Exception\InvalidArgumentException; /** * Resolver for placeholder tokens based upon typed data. @@ -83,7 +84,7 @@ class PlaceholderResolver implements PlaceholderResolverInterface { // Escape the tokens, unless they are explicitly markup. $replacements[$placeholder] = $value instanceof MarkupInterface ? $value : new HtmlEscapedText($value); } - catch (\InvalidArgumentException $e) { + catch (InvalidArgumentException $e) { // Should we log warnings if there are problems other than missing // data, like syntactically invalid placeholders? if (!empty($options['clear'])) { @@ -117,7 +118,7 @@ class PlaceholderResolver implements PlaceholderResolverInterface { * entry is another numerically indexed array containing two items: the * the filter id and the array of filter arguments. * - * @throws \InvalidArgumentException + * @throws \Drupal\rules\Exception\InvalidArgumentException * Thrown if in invalid placeholders are to be parsed. */ protected function parseMainPlaceholderPart($main_part, $placeholder) { diff --git a/src/Ui/RulesUiDefinition.php b/src/Ui/RulesUiDefinition.php index d7432bcac49278b4051553c458f8480186800a1f..e2bc27a9848ad2d6c7add89b9e2e5fa7276e9c57 100644 --- a/src/Ui/RulesUiDefinition.php +++ b/src/Ui/RulesUiDefinition.php @@ -3,6 +3,7 @@ namespace Drupal\rules\Ui; use Drupal\Component\Plugin\Definition\PluginDefinitionInterface; +use Drupal\rules\Exception\LogicException; /** * Class for rules_ui plugin definitions. @@ -125,20 +126,20 @@ class RulesUiDefinition implements PluginDefinitionInterface { /** * Validates the set property values. * - * @throws \LogicException + * @throws \Drupal\rules\Exception\LogicException * Thrown if the set object properties are not valid. */ public function validate() { if (!isset($this->id)) { - throw new \LogicException("Missing the required property 'id'."); + throw new LogicException("Missing the required property 'id'."); } foreach (['label', 'class', 'provider', 'base_route'] as $required) { if (!isset($this->$required)) { - throw new \LogicException("Plugin {$this->id} misses the required property $required."); + throw new LogicException("Plugin {$this->id} misses the required property $required."); } } if (!is_subclass_of($this->class, RulesUiHandlerInterface::class)) { - throw new \LogicException("The provided class does not implement the RulesUiHandlerInterface."); + throw new LogicException("The provided class does not implement the RulesUiHandlerInterface."); } } diff --git a/tests/src/Integration/Action/DataConvertTest.php b/tests/src/Integration/Action/DataConvertTest.php index 186ae912c0136a0bad391c155c67f1eee3f49ed3..f99a524d160950c75536eda67660d50c4fc70466 100644 --- a/tests/src/Integration/Action/DataConvertTest.php +++ b/tests/src/Integration/Action/DataConvertTest.php @@ -92,7 +92,7 @@ class DataConvertTest extends RulesIntegrationTestBase { * * @covers ::execute * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException */ public function testInvalidValueException() { $this->executeAction(['some-array'], 'integer'); @@ -103,7 +103,7 @@ class DataConvertTest extends RulesIntegrationTestBase { * * @covers ::execute * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException */ public function testInvalidRoundingBehavior() { $converted = $this->executeAction('some', 'decimal', 'down'); @@ -115,7 +115,7 @@ class DataConvertTest extends RulesIntegrationTestBase { * * @covers ::execute * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException */ public function testInvalidRoundingBehaviorException() { $value = 5.5; @@ -128,7 +128,7 @@ class DataConvertTest extends RulesIntegrationTestBase { * * @covers ::execute * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException */ public function testInvalidTargetTypeException() { $value = 5.5; diff --git a/tests/src/Integration/Condition/UserHasRoleTest.php b/tests/src/Integration/Condition/UserHasRoleTest.php index c1dc573b725a4da7a752a2a5059384444e57777a..b48ff06542c27b5296b78863602789e82eb2c2d2 100644 --- a/tests/src/Integration/Condition/UserHasRoleTest.php +++ b/tests/src/Integration/Condition/UserHasRoleTest.php @@ -88,7 +88,7 @@ class UserHasRoleTest extends RulesEntityIntegrationTestBase { * * @covers ::execute * - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException */ public function testInvalidOperationException() { // Set-up a mock object with roles 'authenticated' and 'editor', but not diff --git a/tests/src/Integration/Engine/LoopTest.php b/tests/src/Integration/Engine/LoopTest.php index da9383b98d63eef85a4188f8ac9ed7f518dd4017..107c573836d98b2214c5a472e375ad399acdb827 100644 --- a/tests/src/Integration/Engine/LoopTest.php +++ b/tests/src/Integration/Engine/LoopTest.php @@ -296,7 +296,7 @@ class LoopTest extends RulesEntityIntegrationTestBase { /** * Tests that the loop list item variable is not available after the loop. * - * @expectedException \Drupal\rules\Exception\RulesEvaluationException + * @expectedException \Drupal\rules\Exception\EvaluationException * * @expectedExceptionMessage Unable to get variable list_item, it is not defined. */ diff --git a/tests/src/Kernel/ContextIntegrationTest.php b/tests/src/Kernel/ContextIntegrationTest.php index 0ff690c9e966e6aa8594d8f6a412a1e43803064b..a854d5422ff911494137441c35e72a244bf19b03 100644 --- a/tests/src/Kernel/ContextIntegrationTest.php +++ b/tests/src/Kernel/ContextIntegrationTest.php @@ -5,7 +5,7 @@ namespace Drupal\Tests\rules\Kernel; use Drupal\rules\Context\ContextConfig; use Drupal\rules\Context\ContextDefinition; use Drupal\rules\Engine\RulesComponent; -use Drupal\rules\Exception\RulesEvaluationException; +use Drupal\rules\Exception\EvaluationException; /** * Tests the the extended core context API with Rules. @@ -37,7 +37,7 @@ class ContextIntegrationTest extends RulesDrupalTestBase { $component->execute(); $this->fail('No exception thrown when required context value is NULL'); } - catch (RulesEvaluationException $e) { + catch (EvaluationException $e) { $this->pass('Exception thrown as expected when a required context is NULL'); } } @@ -61,7 +61,7 @@ class ContextIntegrationTest extends RulesDrupalTestBase { $rule->execute(); $this->fail('No exception thrown when required context value is NULL'); } - catch (RulesEvaluationException $e) { + catch (EvaluationException $e) { $this->pass('Exception thrown as expected when a required context is NULL'); } } diff --git a/tests/src/Kernel/TypedData/DataDefinitionFetcherTest.php b/tests/src/Kernel/TypedData/DataDefinitionFetcherTest.php index 97525c14e607c71adbd48b9d14cd14e0dad312b5..baf977f1603739a2f8b28753dcd5c727137b63e7 100644 --- a/tests/src/Kernel/TypedData/DataDefinitionFetcherTest.php +++ b/tests/src/Kernel/TypedData/DataDefinitionFetcherTest.php @@ -174,7 +174,7 @@ class DataDefinitionFetcherTest extends KernelTestBase { /** * @covers ::fetchDefinitionByPropertyPath - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException * @expectedExceptionMessage Unable to apply data selector 'field_invalid.0.value' at 'field_invalid' */ public function testFetchingInvalidProperty() { @@ -217,7 +217,7 @@ class DataDefinitionFetcherTest extends KernelTestBase { /** * @covers ::fetchDefinitionByPropertyPath - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException * @expectedExceptionMessage The data selector 'field_integer.0.value.not_existing' cannot be applied because the parent property 'value' is not a list or a complex structure */ public function testFetchingNonComplexType() { @@ -230,7 +230,7 @@ class DataDefinitionFetcherTest extends KernelTestBase { /** * @covers ::fetchDefinitionByPropertyPath - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException * @expectedExceptionMessage The data selector 'unknown_property' cannot be applied because the definition of type 'string' is not a list or a complex structure */ public function testFetchingFromPrimitive() { @@ -248,7 +248,7 @@ class DataDefinitionFetcherTest extends KernelTestBase { /** * @covers ::fetchDefinitionByPropertyPath - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException * @expectedExceptionMessage The data selector 'unknown_property' cannot be applied because the definition of type 'integer' is not a list or a complex structure */ public function testFetchingAtInvalidPosition() { diff --git a/tests/src/Kernel/TypedData/DataFetcherTest.php b/tests/src/Kernel/TypedData/DataFetcherTest.php index e1d87aa7c3de743c7d46d64a0b4f9ffd9fcddfa0..2dc40a6cab267b361e2e89da3ab8cc00735c18b9 100644 --- a/tests/src/Kernel/TypedData/DataFetcherTest.php +++ b/tests/src/Kernel/TypedData/DataFetcherTest.php @@ -194,7 +194,7 @@ class DataFetcherTest extends KernelTestBase { /** * @cover fetchDataByPropertyPath - * @expectedException \InvalidArgumentException + * @expectedException \Drupal\rules\Exception\InvalidArgumentException * @expectedExceptionMessage Unable to apply data selector 'field_invalid.0.value' at 'field_invalid' */ public function testFetchingInvalidProperty() { diff --git a/tests/src/Unit/ContextHandlerTraitTest.php b/tests/src/Unit/ContextHandlerTraitTest.php index 2b188209d12370a21673c61a60d4fe9ba4219f8e..5e32999e550367c80373ac270a3dec22d58b4a4e 100644 --- a/tests/src/Unit/ContextHandlerTraitTest.php +++ b/tests/src/Unit/ContextHandlerTraitTest.php @@ -19,7 +19,7 @@ class ContextHandlerTraitTest extends RulesUnitTestBase { * * @covers ::prepareContext * - * @expectedException \Drupal\rules\Exception\RulesEvaluationException + * @expectedException \Drupal\rules\Exception\EvaluationException * * @expectedExceptionMessage Required context test is missing for plugin testplugin. */