From 299e653a45dd7ca511ee3de9ef3e6d1e65e64bca Mon Sep 17 00:00:00 2001 From: fago <fago@wolfgangziegler.net> Date: Tue, 8 Dec 2015 17:12:18 +0100 Subject: [PATCH] Issue #2501927: Some small docu improvements for the RulesComponent class and other various code style fixes. --- src/Engine/RulesComponent.php | 5 ++--- src/Engine/RulesStateInterface.php | 2 +- tests/src/Integration/Engine/RulesComponentTest.php | 2 ++ tests/src/Kernel/ConfigEntityDefaultsTest.php | 1 - tests/src/Unit/RuleTest.php | 6 ------ 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Engine/RulesComponent.php b/src/Engine/RulesComponent.php index d997d2a1..814cf401 100644 --- a/src/Engine/RulesComponent.php +++ b/src/Engine/RulesComponent.php @@ -7,7 +7,6 @@ namespace Drupal\rules\Engine; -use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\rules\Context\ContextDefinitionInterface; /** @@ -61,7 +60,7 @@ class RulesComponent { * @param \Drupal\rules\Engine\ExpressionInterface $expression * The expression of the component. */ - protected function __construct($expression) { + protected function __construct(ExpressionInterface $expression) { $this->state = RulesState::create(); $this->expression = $expression; } @@ -89,7 +88,7 @@ class RulesComponent { /** * Adds a context definition. * - * @param $name + * @param string $name * The name of the context to add. * @param \Drupal\rules\Context\ContextDefinitionInterface $definition * The definition to add. diff --git a/src/Engine/RulesStateInterface.php b/src/Engine/RulesStateInterface.php index a59d05f3..3ab6597a 100644 --- a/src/Engine/RulesStateInterface.php +++ b/src/Engine/RulesStateInterface.php @@ -19,7 +19,7 @@ interface RulesStateInterface { /** * Adds a state variable based on its definition and value. * - * @param $name + * @param string $name * The context variable name. * @param \Drupal\rules\Context\ContextDefinitionInterface $definition * The context definition of the variable. diff --git a/tests/src/Integration/Engine/RulesComponentTest.php b/tests/src/Integration/Engine/RulesComponentTest.php index 4947cae3..e0bb2926 100644 --- a/tests/src/Integration/Engine/RulesComponentTest.php +++ b/tests/src/Integration/Engine/RulesComponentTest.php @@ -16,6 +16,7 @@ use Drupal\Tests\rules\Integration\RulesIntegrationTestBase; * Tests the Rules component class. * * @group rules + * * @cover RulesComponent */ class RulesComponentTest extends RulesIntegrationTestBase { @@ -39,4 +40,5 @@ class RulesComponentTest extends RulesIntegrationTestBase { // Ensure the provided context is returned. // $this->assertTrue(isset($result['concatenated']) && $result['concatenated'] == 'foo.foo'); } + } diff --git a/tests/src/Kernel/ConfigEntityDefaultsTest.php b/tests/src/Kernel/ConfigEntityDefaultsTest.php index cf0f50a9..7c73ed46 100644 --- a/tests/src/Kernel/ConfigEntityDefaultsTest.php +++ b/tests/src/Kernel/ConfigEntityDefaultsTest.php @@ -65,7 +65,6 @@ class ConfigEntityDefaultsTest extends RulesDrupalTestBase { $user = $this->entityTypeManager->getStorage('user') ->create(array('mail' => 'test@example.com')); - /** @var $config_entity \Drupal\rules\Entity\RulesComponent */ $config_entity ->getComponent() ->setContextValue('user', $user) diff --git a/tests/src/Unit/RuleTest.php b/tests/src/Unit/RuleTest.php index e69b37c8..e6c481b5 100644 --- a/tests/src/Unit/RuleTest.php +++ b/tests/src/Unit/RuleTest.php @@ -7,13 +7,7 @@ namespace Drupal\Tests\rules\Unit; -use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Entity\EntityInterface; -use Drupal\rules\Context\ContextDefinitionInterface; -use Drupal\rules\Engine\ConditionExpressionInterface; -use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\rules\Engine\ExpressionManagerInterface; -use Drupal\rules\Engine\RulesComponent; use Drupal\rules\Engine\RulesStateInterface; use Drupal\rules\Plugin\RulesExpression\Rule; use Drupal\rules\Plugin\RulesExpression\RulesAnd; -- GitLab