Skip to content

Commit a952e97

Browse files
authored
rector: InlineArrayReturnAssignRector (OpenMage#4868)
* rector: `InlineArrayReturnAssignRector` - see https://getrector.com/rule-detail/inline-array-return-assign-rector * cs
1 parent 0df7e64 commit a952e97

File tree

13 files changed

+59
-70
lines changed

13 files changed

+59
-70
lines changed

.rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
CodeQuality\Class_\CompleteDynamicPropertiesRector::class, # todo: TMP (!?!)
4747
CodeQuality\Class_\InlineConstructorDefaultToPropertyRector::class, # todo: TMP
4848
CodeQuality\ClassMethod\ExplicitReturnNullRector::class, # todo: TMP
49-
CodeQuality\ClassMethod\InlineArrayReturnAssignRector::class, # todo: TMP
5049
CodeQuality\Concat\JoinStringConcatRector::class, # todo: TMP
5150
CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class, # todo: TMP
5251
CodeQuality\Equal\UseIdenticalOverEqualWithSameTypeRector::class, # todo: TMP

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Date/Short.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class Mage_Adminhtml_Model_System_Config_Source_Date_Short
1515
{
1616
public function toOptionArray()
1717
{
18-
$arr = [];
19-
$arr[] = ['label' => '', 'value' => ''];
20-
$arr[] = ['label' => sprintf('MM/DD/YY (%s)', date('m/d/y')), 'value' => '%m/%d/%y'];
21-
$arr[] = ['label' => sprintf('MM/DD/YYYY (%s)', date('m/d/Y')), 'value' => '%m/%d/%Y'];
22-
$arr[] = ['label' => sprintf('DD/MM/YY (%s)', date('d/m/y')), 'value' => '%d/%m/%y'];
23-
$arr[] = ['label' => sprintf('DD/MM/YYYY (%s)', date('d/m/Y')), 'value' => '%d/%m/%Y'];
24-
return $arr;
18+
return [
19+
['label' => '', 'value' => ''],
20+
['label' => sprintf('MM/DD/YY (%s)', date('m/d/y')), 'value' => '%m/%d/%y'],
21+
['label' => sprintf('MM/DD/YYYY (%s)', date('m/d/Y')), 'value' => '%m/%d/%Y'],
22+
['label' => sprintf('DD/MM/YY (%s)', date('d/m/y')), 'value' => '%d/%m/%y'],
23+
['label' => sprintf('DD/MM/YYYY (%s)', date('d/m/Y')), 'value' => '%d/%m/%Y'],
24+
];
2525
}
2626
}

app/code/core/Mage/Catalog/Model/Category.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,10 @@ public function getParentIds()
607607
*/
608608
public function getCustomDesignDate()
609609
{
610-
$result = [];
611-
$result['from'] = $this->getData('custom_design_from');
612-
$result['to'] = $this->getData('custom_design_to');
613-
614-
return $result;
610+
return [
611+
'from' => $this->getData('custom_design_from'),
612+
'to' => $this->getData('custom_design_to'),
613+
];
615614
}
616615

617616
/**

app/code/core/Mage/Catalog/Model/Product.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,11 +1638,10 @@ public function getAttributeText($attributeCode)
16381638
*/
16391639
public function getCustomDesignDate()
16401640
{
1641-
$result = [];
1642-
$result['from'] = $this->getData('custom_design_from');
1643-
$result['to'] = $this->getData('custom_design_to');
1644-
1645-
return $result;
1641+
return [
1642+
'from' => $this->getData('custom_design_from'),
1643+
'to' => $this->getData('custom_design_to'),
1644+
];
16461645
}
16471646

16481647
/**

app/code/core/Mage/Catalog/Model/Product/Compare/Item.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,11 @@ public function addProductData($product)
142142
*/
143143
public function getDataForSave()
144144
{
145-
$data = [];
146-
$data['customer_id'] = $this->getCustomerId();
147-
$data['visitor_id'] = $this->getVisitorId();
148-
$data['product_id'] = $this->getProductId();
149-
150-
return $data;
145+
return [
146+
'customer_id' => $this->getCustomerId(),
147+
'visitor_id' => $this->getVisitorId(),
148+
'product_id' => $this->getProductId(),
149+
];
151150
}
152151

153152
/**

app/code/core/Mage/CatalogIndex/Model/Indexer/Tierprice.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ protected function _isAttributeIndexable(Mage_Eav_Model_Entity_Attribute_Abstrac
112112
*/
113113
protected function _getIndexableAttributeConditions()
114114
{
115-
$conditions = [];
116-
$conditions['attribute_code'] = 'tier_price';
117-
118-
return $conditions;
115+
return ['attribute_code' => 'tier_price'];
119116
}
120117
}

app/code/core/Mage/Core/Model/Config.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,12 +1297,10 @@ public function loadEventObservers($area)
12971297
*/
12981298
public function getPathVars($args = null)
12991299
{
1300-
$path = [];
1301-
1302-
$path['baseUrl'] = Mage::getBaseUrl();
1303-
$path['baseSecureUrl'] = Mage::getBaseUrl('link', true);
1304-
1305-
return $path;
1300+
return [
1301+
'baseUrl' => Mage::getBaseUrl(),
1302+
'baseSecureUrl' => Mage::getBaseUrl('link', true),
1303+
];
13061304
}
13071305

13081306
/**

app/code/core/Mage/Core/Model/Magento/Api.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ class Mage_Core_Model_Magento_Api extends Mage_Api_Model_Resource_Abstract
2121
*/
2222
public function info()
2323
{
24-
$result = [];
25-
$result['magento_edition'] = Mage::getEdition();
26-
$result['magento_version'] = Mage::getVersion();
27-
$result['openmage_version'] = Mage::getOpenMageVersion();
28-
29-
return $result;
24+
return [
25+
'magento_edition' => Mage::getEdition(),
26+
'magento_version' => Mage::getVersion(),
27+
'openmage_version' => Mage::getOpenMageVersion(),
28+
];
3029
}
3130
}

app/code/core/Mage/Newsletter/Model/Queue.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ protected function _finishQueue()
230230
*/
231231
public function getDataForSave()
232232
{
233-
$data = [];
234-
$data['template_id'] = $this->getTemplateId();
235-
$data['queue_status'] = $this->getQueueStatus();
236-
$data['queue_start_at'] = $this->getQueueStartAt();
237-
$data['queue_finish_at'] = $this->getQueueFinishAt();
238-
return $data;
233+
return [
234+
'template_id' => $this->getTemplateId(),
235+
'queue_status' => $this->getQueueStatus(),
236+
'queue_start_at' => $this->getQueueStartAt(),
237+
'queue_finish_at' => $this->getQueueFinishAt(),
238+
];
239239
}
240240

241241
/**

app/code/core/Mage/Sales/Model/Order/Shipment/Track.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ public function getNumberDetail()
128128
{
129129
$carrierInstance = Mage::getSingleton('shipping/config')->getCarrierInstance($this->getCarrierCode());
130130
if (!$carrierInstance) {
131-
$custom = [];
132-
$custom['title'] = $this->getTitle();
133-
$custom['number'] = $this->getTrackNumber();
134-
return $custom;
131+
return [
132+
'title' => $this->getTitle(),
133+
'number' => $this->getTrackNumber(),
134+
];
135135
} else {
136136
$carrierInstance->setStore($this->getStore());
137137
}

0 commit comments

Comments
 (0)