Skip to content

Commit e73f29c

Browse files
author
Stanislav Idolov
authored
ENGCOM-1629: [Backport] Eliminate usage of "else" statements #15309
2 parents a07e620 + 5365c12 commit e73f29c

File tree

15 files changed

+21
-41
lines changed

15 files changed

+21
-41
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Radio.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public function getCondition()
3131
{
3232
if ($this->getValue()) {
3333
return $this->getColumn()->getValue();
34-
} else {
35-
return [['neq' => $this->getColumn()->getValue()], ['is' => new \Zend_Db_Expr('NULL')]];
3634
}
35+
return [['neq' => $this->getColumn()->getValue()], ['is' => new \Zend_Db_Expr('NULL')]];
3736
}
3837
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ public function getSelectedJson()
205205
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
206206
$selected = explode(',', $selected);
207207
return join(',', $selected);
208-
} else {
209-
return '';
210208
}
209+
return '';
211210
}
212211

213212
/**
@@ -220,9 +219,8 @@ public function getSelected()
220219
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
221220
$selected = explode(',', $selected);
222221
return $selected;
223-
} else {
224-
return [];
225222
}
223+
return [];
226224
}
227225

228226
/**

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ public function getSelectedJson()
215215
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
216216
$selected = explode(',', $selected);
217217
return join(',', $selected);
218-
} else {
219-
return '';
220218
}
219+
return '';
221220
}
222221

223222
/**
@@ -230,9 +229,8 @@ public function getSelected()
230229
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
231230
$selected = explode(',', $selected);
232231
return $selected;
233-
} else {
234-
return [];
235232
}
233+
return [];
236234
}
237235

238236
/**

app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ public function execute()
4646
// redirect according to rewrite rule
4747
if ($requestUrl != $backendUrl) {
4848
return $this->getRedirect($backendUrl);
49-
} else {
50-
return $this->resultPageFactory->create();
5149
}
50+
return $this->resultPageFactory->create();
5251
}
5352

5453
/**

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ private function getSecurityCookie()
2929
{
3030
if (!($this->securityCookie instanceof SecurityCookie)) {
3131
return \Magento\Framework\App\ObjectManager::getInstance()->get(SecurityCookie::class);
32-
} else {
33-
return $this->securityCookie;
3432
}
33+
return $this->securityCookie;
3534
}
3635

3736
/**

app/code/Magento/Braintree/Test/Unit/Model/Report/BraintreeTransactionStub.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ public function __get($name)
3434
{
3535
if (array_key_exists($name, $this->_attributes)) {
3636
return $this->_attributes[$name];
37-
} else {
38-
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
39-
return null;
4037
}
38+
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
39+
return null;
4140
}
4241

4342
/**

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ public function getChildren($item)
6262

6363
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
6464
return $itemsArray[$item->getOrderItem()->getId()];
65-
} else {
66-
return null;
6765
}
66+
return null;
6867
}
6968

7069
/**
@@ -186,9 +185,8 @@ public function getOrderItem()
186185
{
187186
if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) {
188187
return $this->getItem();
189-
} else {
190-
return $this->getItem()->getOrderItem();
191188
}
189+
return $this->getItem()->getOrderItem();
192190
}
193191

194192
/**

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,8 @@ public function isSelected($selection)
174174
return in_array($selection->getSelectionId(), $selectedOptions);
175175
} elseif ($selectedOptions == 'None') {
176176
return false;
177-
} else {
178-
return $selection->getIsDefault() && $selection->isSaleable();
179177
}
178+
return $selection->getIsDefault() && $selection->isSaleable();
180179
}
181180

182181
/**

app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ public function getValueHtml($item)
114114
if ($attributes = $this->getSelectionAttributes($item)) {
115115
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
116116
. $this->getOrder()->formatPrice($attributes['price']);
117-
} else {
118-
return $this->escapeHtml($item->getName());
119117
}
118+
return $this->escapeHtml($item->getName());
120119
}
121120

122121
/**
@@ -151,9 +150,8 @@ public function getChildren($item)
151150

152151
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
153152
return $itemsArray[$item->getOrderItem()->getId()];
154-
} else {
155-
return null;
156153
}
154+
return null;
157155
}
158156

159157
/**

app/code/Magento/Bundle/Model/Plugin/PriceBackend.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public function aroundValidate(
2929
&& $object->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC
3030
) {
3131
return true;
32-
} else {
33-
return $proceed($object);
3432
}
33+
return $proceed($object);
3534
}
3635
}

0 commit comments

Comments
 (0)