Skip to content

Commit d433ae9

Browse files
authored
PHPStan: return type fixes (#2587)
1 parent 97e0b70 commit d433ae9

File tree

45 files changed

+83
-283
lines changed

Some content is hidden

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

45 files changed

+83
-283
lines changed

.github/phpstan-baseline.neon

Lines changed: 0 additions & 230 deletions
Large diffs are not rendered by default.

app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class Mage_Adminhtml_Block_Newsletter_Queue_Edit extends Mage_Adminhtml_Block_Te
2929
{
3030
/**
3131
* Check for template Id in request
32-
*
3332
*/
3433
protected function _construct()
3534
{
@@ -50,6 +49,9 @@ public function getQueue()
5049
return Mage::registry('current_queue');
5150
}
5251

52+
/**
53+
* @inheritDoc
54+
*/
5355
protected function _beforeToHtml() {
5456

5557
$this->setTemplate('newsletter/queue/edit.phtml');
@@ -61,6 +63,10 @@ protected function _beforeToHtml() {
6163
return parent::_beforeToHtml();
6264
}
6365

66+
/**
67+
* @return string
68+
* @throws Exception
69+
*/
6470
public function getSaveUrl()
6571
{
6672
if ($this->getTemplateId()) {
@@ -71,6 +77,9 @@ public function getSaveUrl()
7177
return $this->getUrl('*/*/save', $params);
7278
}
7379

80+
/**
81+
* @inheritDoc
82+
*/
7483
protected function _prepareLayout()
7584
{
7685
// Load Wysiwyg on demand and Prepare layout
@@ -244,10 +253,10 @@ public function getCanResume()
244253
/**
245254
* Getter for header text
246255
*
247-
* @return bool
256+
* @return string
248257
*/
249258
public function getHeaderText()
250259
{
251-
return ( $this->getIsPreview() ? Mage::helper('newsletter')->__('View Newsletter') : Mage::helper('newsletter')->__('Edit Newsletter'));
260+
return ($this->getIsPreview() ? Mage::helper('newsletter')->__('View Newsletter') : Mage::helper('newsletter')->__('Edit Newsletter'));
252261
}
253262
}

app/code/core/Mage/Adminhtml/Block/Report/Grid/Shopcart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Mage_Adminhtml_Block_Report_Grid_Shopcart extends Mage_Adminhtml_Block_Wid
4141
* storeIds setter
4242
*
4343
* @param array $storeIds
44-
* @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
44+
* @return $this
4545
*/
4646
public function setStoreIds($storeIds)
4747
{

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function _prepareCollection()
6363
/**
6464
* Prepare and add columns to grid
6565
*
66-
* @return Mage_Adminhtml_Block_Widget_Grid
66+
* @inheritDoc
6767
*/
6868
protected function _prepareColumns()
6969
{
@@ -130,20 +130,16 @@ protected function _prepareColumns()
130130
/**
131131
* Get url for row
132132
*
133-
* @param string $row
134-
* @return string
133+
* @param Mage_Sales_Model_Order_Shipment $row
134+
* @return string|false
135135
*/
136136
public function getRowUrl($row)
137137
{
138138
if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
139139
return false;
140140
}
141141

142-
return $this->getUrl('*/sales_shipment/view',
143-
[
144-
'shipment_id'=> $row->getId(),
145-
]
146-
);
142+
return $this->getUrl('*/sales_shipment/view', ['shipment_id' => $row->getId()]);
147143
}
148144

149145
/**

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Catalog/Search/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Catalog_Search_Type extends Mag
3030
/**
3131
* After change Catalog Search Type process
3232
*
33-
* @return Mage_Adminhtml_Model_System_Config_Catalog_Search_Type
33+
* @return $this
3434
*/
3535
protected function _afterSave()
3636
{

app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function preDispatch()
5555
$this->_setForcedFormKeyActions('delete');
5656
parent::preDispatch();
5757
$this->_entityTypeId = Mage::getModel('eav/entity')->setType(Mage_Catalog_Model_Product::ENTITY)->getTypeId();
58+
return $this;
5859
}
5960

6061
protected function _initAction()

app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ protected function _isSectionAllowed($section)
289289
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
290290
return false;
291291
}
292+
return false;
292293
}
293294

294295
/**

app/code/core/Mage/Api2/Block/Adminhtml/Permissions/User/Edit/Tab/Roles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function canShowTab()
169169
/**
170170
* Returns status flag about this tab hidden or not
171171
*
172-
* @return true
172+
* @return false
173173
*/
174174
public function isHidden()
175175
{

app/code/core/Mage/Catalog/Block/Product/Gallery.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,23 @@ protected function _prepareLayout()
3939
}
4040

4141
/**
42-
* @return mixed
42+
* @return Mage_Catalog_Model_Product
4343
*/
4444
public function getProduct()
4545
{
4646
return Mage::registry('product');
4747
}
4848

4949
/**
50-
* @return mixed
50+
* @return Varien_Data_Collection
5151
*/
5252
public function getGalleryCollection()
5353
{
5454
return $this->getProduct()->getMediaGalleryImages();
5555
}
5656

5757
/**
58-
* @return null |null
58+
* @return Varien_Object|null
5959
* @throws Exception
6060
*/
6161
public function getCurrentImage()
@@ -91,7 +91,7 @@ public function getImageFile()
9191
/**
9292
* Retrieve image width
9393
*
94-
* @return bool|int
94+
* @return false|int
9595
*/
9696
public function getImageWidth()
9797
{
@@ -111,7 +111,8 @@ public function getImageWidth()
111111
}
112112

113113
/**
114-
* @return bool
114+
* @return false|Varien_Object
115+
* @throws Exception
115116
*/
116117
public function getPreviusImage()
117118
{
@@ -130,7 +131,8 @@ public function getPreviusImage()
130131
}
131132

132133
/**
133-
* @return bool
134+
* @return false|Varien_Object
135+
* @throws Exception
134136
*/
135137
public function getNextImage()
136138
{
@@ -153,23 +155,23 @@ public function getNextImage()
153155
}
154156

155157
/**
156-
* @return bool|string
158+
* @return false|string
157159
*/
158160
public function getPreviusImageUrl()
159161
{
160162
if ($image = $this->getPreviusImage()) {
161-
return $this->getUrl('*/*/*', ['_current'=>true, 'image'=>$image->getValueId()]);
163+
return $this->getUrl('*/*/*', ['_current' => true, 'image' => $image->getValueId()]);
162164
}
163165
return false;
164166
}
165167

166168
/**
167-
* @return bool|string
169+
* @return false|string
168170
*/
169171
public function getNextImageUrl()
170172
{
171173
if ($image = $this->getNextImage()) {
172-
return $this->getUrl('*/*/*', ['_current'=>true, 'image'=>$image->getValueId()]);
174+
return $this->getUrl('*/*/*', ['_current' => true, 'image' => $image->getValueId()]);
173175
}
174176
return false;
175177
}

app/code/core/Mage/Catalog/Block/Product/View/Tabs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Mage_Catalog_Block_Product_View_Tabs extends Mage_Core_Block_Template
3636
* @param string $title
3737
* @param string $block
3838
* @param string $template
39-
* @return bool
39+
* @return false|void
4040
*/
4141
public function addTab($alias, $title, $block, $template)
4242
{

0 commit comments

Comments
 (0)