Skip to content

Commit 4276a24

Browse files
Stanislav Idolovadrian-martinez-interactiv4
Stanislav Idolov
authored andcommitted
Fixed reset method usage
1 parent 79b74b6 commit 4276a24

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/code/Magento/Rule/Model/Condition/AbstractCondition.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,13 @@ public function __construct(Context $context, array $data = [])
8383

8484
$options = $this->getAttributeOptions();
8585
if ($options) {
86-
$this->setAttribute(key(reset($options)));
86+
reset($options);
87+
$this->setAttribute(key($options));
8788
}
8889
$options = $this->getOperatorOptions();
8990
if ($options) {
90-
$this->setOperator(key(reset($options)));
91+
reset($options);
92+
$this->setOperator(key($options));
9193
}
9294
}
9395

@@ -506,7 +508,8 @@ public function getAttributeElement()
506508
if (null === $this->getAttribute()) {
507509
$options = $this->getAttributeOption();
508510
if ($options) {
509-
$this->setAttribute(key(reset($options)));
511+
reset($options);
512+
$this->setAttribute(key($options));
510513
}
511514
}
512515
return $this->getForm()->addField(
@@ -542,7 +545,7 @@ public function getOperatorElement()
542545
{
543546
$options = $this->getOperatorSelectOptions();
544547
if ($this->getOperator() === null) {
545-
$option = current(reset($options));
548+
$option = reset($options);
546549
$this->setOperator($option['value']);
547550
}
548551

0 commit comments

Comments
 (0)