Skip to content

Issue #2625986: enforce type string for plugin IDs. #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 8.x-3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Engine/ExpressionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function createReactionRule(array $configuration = []) {
* {@inheritdoc}
*/
public function createAction($id) {
if (!is_string($id)) {
throw new \InvalidArgumentException(t('Rules Action IDs must be strings.'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception messages should not use t(), we are in the lowest levels of API here.

}
return $this->createInstance('rules_action', [
'action_id' => $id,
]);
Expand All @@ -59,6 +62,9 @@ public function createAction($id) {
* {@inheritdoc}
*/
public function createCondition($id) {
if (!is_string($id)) {
throw new \InvalidArgumentException(t('Condition IDs must be strings.'));
}
return $this->createInstance('rules_condition', [
'condition_id' => $id,
]);
Expand Down