Skip to content

Commit 99d3afb

Browse files
sreichelfballiano
authored andcommitted
Phpstan: fixed return types (docs only) (#2636)
1 parent efca826 commit 99d3afb

File tree

83 files changed

+410
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+410
-620
lines changed

.github/phpstan-baseline.neon

Lines changed: 7 additions & 417 deletions
Large diffs are not rendered by default.

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid/Filter/Inventory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid_Filter_Inventory extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
3030
{
31+
/**
32+
* @return array
33+
*/
3134
protected function _getOptions()
3235
{
3336
return [

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@
2828
*/
2929
class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price extends Varien_Data_Form_Element_Text
3030
{
31+
/**
32+
* @param array $attributes
33+
*/
3134
public function __construct($attributes= [])
3235
{
3336
parent::__construct($attributes);
3437
$this->addClass('validate-zero-or-greater');
3538
}
3639

40+
/**
41+
* @return string
42+
* @throws Mage_Core_Model_Store_Exception
43+
*/
3744
public function getAfterElementHtml()
3845
{
3946
$html = parent::getAfterElementHtml();
@@ -61,13 +68,21 @@ public function getAfterElementHtml()
6168
return $html;
6269
}
6370

71+
/**
72+
* @param $attribute
73+
* @return string
74+
*/
6475
protected function _getTaxObservingCode($attribute)
6576
{
6677
$spanId = "dynamic-tax-{$attribute->getAttributeCode()}";
6778

6879
return "<script type='text/javascript'>if (dynamicTaxes == undefined) var dynamicTaxes = new Array(); dynamicTaxes[dynamicTaxes.length]='{$attribute->getAttributeCode()}'</script>";
6980
}
7081

82+
/**
83+
* @param null $index
84+
* @return string|null
85+
*/
7186
public function getEscapedValue($index=null)
7287
{
7388
$value = $this->getValue();

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Newsletter/Grid/Filter/Status.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public function __construct()
4343
parent::__construct();
4444
}
4545

46+
/**
47+
* @return array
48+
*/
4649
protected function _getOptions()
4750
{
4851
$result = [];
@@ -53,9 +56,12 @@ protected function _getOptions()
5356
return $result;
5457
}
5558

59+
/**
60+
* @return array|null
61+
*/
5662
public function getCondition()
5763
{
58-
if(is_null($this->getValue())) {
64+
if (is_null($this->getValue())) {
5965
return null;
6066
}
6167

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@
2626
* @package Mage_Adminhtml
2727
* @author Magento Core Team <[email protected]>
2828
*/
29-
class Mage_Adminhtml_Block_Customer_Edit_Tab_View
30-
extends Mage_Adminhtml_Block_Template
31-
implements Mage_Adminhtml_Block_Widget_Tab_Interface
29+
class Mage_Adminhtml_Block_Customer_Edit_Tab_View extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
3230
{
31+
/**
32+
* @var Mage_Customer_Model_Customer
33+
*/
3334
protected $_customer;
3435

3536
protected $_customerLog;
3637

38+
/**
39+
* @return Mage_Customer_Model_Customer
40+
*/
3741
public function getCustomer()
3842
{
3943
if (!$this->_customer) {
@@ -42,6 +46,9 @@ public function getCustomer()
4246
return $this->_customer;
4347
}
4448

49+
/**
50+
* @return string|void
51+
*/
4552
public function getGroupName()
4653
{
4754
if ($groupId = $this->getCustomer()->getGroupId()) {
@@ -77,9 +84,12 @@ public function getCreateDate()
7784
: null;
7885
}
7986

87+
/**
88+
* @return string|null
89+
*/
8090
public function getStoreCreateDate()
8191
{
82-
if ( ! $this->getCustomer()->getCreatedAt()) {
92+
if (! $this->getCustomer()->getCreatedAt()) {
8393
return null;
8494
}
8595
$date = Mage::app()->getLocale()->storeDate(
@@ -108,6 +118,9 @@ public function getLastLoginDate()
108118
: Mage::helper('customer')->__('Never');
109119
}
110120

121+
/**
122+
* @return string
123+
*/
111124
public function getStoreLastLoginDate()
112125
{
113126
if ($date = $this->getCustomerLog()->getLoginAtTimestamp()) {
@@ -127,6 +140,9 @@ public function getStoreLastLoginDateTimezone()
127140
->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
128141
}
129142

143+
/**
144+
* @return string
145+
*/
130146
public function getCurrentStatus()
131147
{
132148
$log = $this->getCustomerLog();
@@ -138,6 +154,9 @@ public function getCurrentStatus()
138154
return Mage::helper('customer')->__('Online');
139155
}
140156

157+
/**
158+
* @return string
159+
*/
141160
public function getIsConfirmedStatus()
142161
{
143162
$this->getCustomer();
@@ -160,38 +179,55 @@ public function getStoreId()
160179
return $this->getCustomer()->getStoreId();
161180
}
162181

182+
/**
183+
* @return string
184+
*/
163185
public function getBillingAddressHtml()
164186
{
165187
$html = '';
166188
if ($address = $this->getCustomer()->getPrimaryBillingAddress()) {
167189
$html = $address->format('html');
168-
}
169-
else {
190+
} else {
170191
$html = Mage::helper('customer')->__('The customer does not have default billing address.');
171192
}
172193
return $html;
173194
}
174195

196+
/**
197+
* @return string
198+
*/
175199
public function getAccordionHtml()
176200
{
177201
return $this->getChildHtml('accordion');
178202
}
179203

204+
/**
205+
* @return string
206+
*/
180207
public function getSalesHtml()
181208
{
182209
return $this->getChildHtml('sales');
183210
}
184211

212+
/**
213+
* @return string
214+
*/
185215
public function getTabLabel()
186216
{
187217
return Mage::helper('customer')->__('Customer View');
188218
}
189219

220+
/**
221+
* @return string
222+
*/
190223
public function getTabTitle()
191224
{
192225
return Mage::helper('customer')->__('Customer View');
193226
}
194227

228+
/**
229+
* @return bool
230+
*/
195231
public function canShowTab()
196232
{
197233
if (Mage::registry('current_customer')->getId()) {
@@ -200,6 +236,9 @@ public function canShowTab()
200236
return false;
201237
}
202238

239+
/**
240+
* @return bool
241+
*/
203242
public function isHidden()
204243
{
205244
if (Mage::registry('current_customer')->getId()) {
@@ -209,9 +248,9 @@ public function isHidden()
209248
}
210249

211250
/**
212-
* @deprecated
213251
* Return instance of core helper
214252
*
253+
* @deprecated
215254
* @return Mage_Core_Helper_Data
216255
*/
217256
protected function _getCoreHelper()

app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ protected function _drawElementHtml($element, array $attributes, $closed = true)
188188
/**
189189
* Return escaped value
190190
*
191-
* @param int $index
192-
* @return string
191+
* @param string|null $index
192+
* @return false|string
193193
*/
194194
public function getEscapedValue($index = null)
195195
{

app/code/core/Mage/Adminhtml/Block/Customer/Form/Element/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function _getPreviewHtml()
8080

8181
/**
8282
* Return Image URL
83-
* @return string
83+
* @return string|false
8484
*/
8585
protected function _getPreviewUrl()
8686
{

app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid/Filter/Website.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,28 @@
2828
*/
2929
class Mage_Adminhtml_Block_Newsletter_Subscriber_Grid_Filter_Website extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
3030
{
31+
/**
32+
* @var Mage_Core_Model_Resource_Website_Collection
33+
*/
3134
protected $_websiteCollection = null;
3235

36+
/**
37+
* @return array[]
38+
*/
3339
protected function _getOptions()
3440
{
3541
$result = $this->getCollection()->toOptionArray();
3642
array_unshift($result, ['label'=>null, 'value'=>null]);
3743
return $result;
3844
}
3945

46+
/**
47+
* @return Mage_Core_Model_Resource_Website_Collection
48+
* @throws Mage_Core_Exception
49+
*/
4050
public function getCollection()
4151
{
42-
if(is_null($this->_websiteCollection)) {
52+
if (is_null($this->_websiteCollection)) {
4353
$this->_websiteCollection = Mage::getResourceModel('core/website_collection')
4454
->load();
4555
}
@@ -49,11 +59,14 @@ public function getCollection()
4959
return $this->_websiteCollection;
5060
}
5161

62+
/**
63+
* @return array|null
64+
* @throws Mage_Core_Exception
65+
*/
5266
public function getCondition()
5367
{
54-
5568
$id = $this->getValue();
56-
if(!$id) {
69+
if (!$id) {
5770
return null;
5871
}
5972

app/code/core/Mage/Adminhtml/Block/Review/Grid/Filter/Type.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
class Mage_Adminhtml_Block_Review_Grid_Filter_Type extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select
3030
{
31+
/**
32+
* @return array
33+
*/
3134
protected function _getOptions()
3235
{
3336
return [
@@ -38,6 +41,9 @@ protected function _getOptions()
3841
];
3942
}
4043

44+
/**
45+
* @return int
46+
*/
4147
public function getCondition()
4248
{
4349
if ($this->getValue() == 1) {

app/code/core/Mage/Adminhtml/Block/Sales/Creditmemo/Grid.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ protected function _getCollectionClass()
4646
return 'sales/order_creditmemo_grid_collection';
4747
}
4848

49+
/**
50+
* @inheritDoc
51+
* @throws Exception
52+
*/
4953
protected function _prepareCollection()
5054
{
5155
$collection = Mage::getResourceModel($this->_getCollectionClass());
5256
$this->setCollection($collection);
5357
return parent::_prepareCollection();
5458
}
5559

60+
/**
61+
* @inheritDoc
62+
* @throws Exception
63+
*/
5664
protected function _prepareColumns()
5765
{
5866
$this->addColumn('increment_id', [
@@ -100,7 +108,8 @@ protected function _prepareColumns()
100108
'currency' => 'order_currency_code',
101109
]);
102110

103-
$this->addColumn('action',
111+
$this->addColumn(
112+
'action',
104113
[
105114
'header' => Mage::helper('sales')->__('Action'),
106115
'width' => '50px',
@@ -116,14 +125,18 @@ protected function _prepareColumns()
116125
'filter' => false,
117126
'sortable' => false,
118127
'is_system' => true
119-
]);
128+
]
129+
);
120130

121131
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
122132
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
123133

124134
return parent::_prepareColumns();
125135
}
126136

137+
/**
138+
* @return $this
139+
*/
127140
protected function _prepareMassaction()
128141
{
129142
$this->setMassactionIdField('entity_id');
@@ -138,19 +151,27 @@ protected function _prepareMassaction()
138151
return $this;
139152
}
140153

154+
/**
155+
* @param Mage_Sales_Model_Order_Creditmemo $row
156+
* @return false|string
157+
*/
141158
public function getRowUrl($row)
142159
{
143160
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/creditmemo')) {
144161
return false;
145162
}
146163

147-
return $this->getUrl('*/sales_creditmemo/view',
164+
return $this->getUrl(
165+
'*/sales_creditmemo/view',
148166
[
149167
'creditmemo_id'=> $row->getId(),
150168
]
151169
);
152170
}
153171

172+
/**
173+
* @return string
174+
*/
154175
public function getGridUrl()
155176
{
156177
return $this->getUrl('*/*/*', ['_current' => true]);

0 commit comments

Comments
 (0)