Skip to content

Commit

Permalink
PHPStan: added missing returns (#2832)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 22, 2022
1 parent 355cff5 commit 2bd4e09
Show file tree
Hide file tree
Showing 56 changed files with 173 additions and 516 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,19 @@ protected function _prepareCollection()
}

/**
* @return void
* @return $this
* @throws Exception
*/
protected function _prepareColumns()
{
/*$this->addColumn('set_id', array(
'header' => Mage::helper('catalog')->__('ID'),
'align' => 'right',
'sortable' => true,
'width' => '50px',
'index' => 'attribute_set_id',
));*/

$this->addColumn('set_name', [
'header' => Mage::helper('catalog')->__('Set Name'),
'align' => 'left',
'sortable' => true,
'index' => 'attribute_set_name',
]);

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ protected function _prepareLayout()
}

/**
* Prepare attributes form
*
* @return void
* @inheritDoc
*/
protected function _prepareForm()
{
Expand Down Expand Up @@ -140,6 +138,8 @@ protected function _prepareForm()

$this->setForm($form);
}

return parent::_prepareForm();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Simple extends
*/
protected $_product = null;

/**
* @return $this
* @throws Mage_Core_Exception
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form();
Expand Down Expand Up @@ -173,6 +177,8 @@ protected function _prepareForm()
]);

$this->setForm($form);

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ public function __construct()
$this->setId('gridAccounts');
}

/**
* @return $this
*/
protected function _prepareCollection()
{
parent::_prepareCollection();
$this->getCollection()->initReport('reports/accounts_collection');
return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ public function __construct()
$this->setId('gridOrdersCustomer');
}

/**
* @return $this
*/
protected function _prepareCollection()
{
parent::_prepareCollection();
$this->getCollection()->initReport('reports/customer_orders_collection');
return $this;
}

/**
* @inheritDoc
*/
protected function _prepareColumns()
{
$this->addColumn('name', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ public function __construct()
$this->setId('gridTotalsCustomer');
}

/**
* @return $this
*/
protected function _prepareCollection()
{
parent::_prepareCollection();
$this->getCollection()->initReport('reports/customer_totals_collection');
return $this;
}

/**
* @inheritDoc
*/
protected function _prepareColumns()
{
$this->addColumn('name', [
Expand Down
7 changes: 6 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Report/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public function __construct()
$this->setCountTotals(true);
}

/**
* @return $this
*/
protected function _prepareLayout()
{
$this->setChild(
Expand Down Expand Up @@ -114,7 +117,7 @@ protected function _prepareColumns()
}

/**
* @return void
* @return $this
*/
protected function _prepareCollection()
{
Expand Down Expand Up @@ -201,6 +204,8 @@ protected function _prepareCollection()
'adminhtml_widget_grid_filter_collection',
['collection' => $this->getCollection(), 'filter_values' => $this->_filterValues]
);

return $this;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ protected function _prepareCollection()
}

/**
* @return void
* @inheritDoc
*/
protected function _afterLoadCollection()
{
$totalObj = new Mage_Reports_Model_Totals();
$this->setTotals($totalObj->countTotals($this));

return parent::_afterLoadCollection();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ public function __construct()
}

/**
* @return void
* @return $this
*/
protected function _prepareCollection()
{
parent::_prepareCollection();
$this->getCollection()->initReport('reports/product_ordered_collection');
return $this;
}

/**
* @inheritDoc
*/
protected function _prepareColumns()
{
$this->addColumn('name', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ protected function _prepareCollection()
}

/**
* @return void
* @inheritDoc
*/
protected function _afterLoadCollection()
{
$this->getCollection()->addCartInfo();
return parent::_afterLoadCollection();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Review/Product/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()
}

/**
* @return void
* @return $this
*/
protected function _prepareColumns()
{
Expand Down Expand Up @@ -103,6 +103,8 @@ protected function _prepareColumns()
]
);
}

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getProducts()
/**
* Return array of selected product ids from post or session
*
* @return string|null
* @return array|string|null
*/
public function getProductIds()
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
* @package Mage_Adminhtml
* @author Magento Core Team <core@magentocommerce.com>
*
* @method string getProductIds()
* @method $this setProductIds(string $value)
* @method array|string getProductIds()
* @method $this setProductIds(array|string $value)
*/
class Mage_Adminhtml_Model_Session extends Mage_Core_Model_Session_Abstract
{
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Api2/Block/Adminhtml/Attribute/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct($attributes = [])

/**
* Collection object set up
* @return void
* @return $this
*/
protected function _prepareCollection()
{
Expand All @@ -54,6 +54,8 @@ protected function _prepareCollection()
}

$this->setCollection($collection);

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes extends Ma
/**
* Prepare attributes form of bundle product
*
* @return void
* @return $this
*/
protected function _prepareForm()
{
Expand Down Expand Up @@ -155,6 +155,8 @@ function changePriceTypeMap() {
. '</script>'
);
}

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs extends Mage_Adminht
protected $_attributeTabBlock = 'bundle/adminhtml_catalog_product_edit_tab_attributes';

/**
* @return void
* @return $this
* @throws Exception
*/
protected function _prepareLayout()
Expand All @@ -44,5 +44,7 @@ protected function _prepareLayout()
'class' => 'ajax',
]);
$this->bindShadowTabs('bundle_items', 'customer_options');

return $this;
}
}
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getRange()
* Retrieve information about products count in range
*
* @param int $range
* @return int
* @return array
*/
public function getRangeItemCounts($range)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function getMaxPriceInt()
* Get information about products count in range
*
* @param int $range
* @return int
* @return array
*/
public function getRangeItemCounts($range)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,8 @@ public function getGroupPrice()
/**
* Get product tier price by qty
*
* @param double $qty
* @return double
* @param float $qty
* @return float|array
*/
public function getTierPrice($qty = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ public function addQtyFilter($comparsionMethod, $qty)
}

/**
* Initialize select object
*
* @return Varien_Db_Select
* @inheritDoc
*/
protected function _initSelect()
{
Expand Down
3 changes: 2 additions & 1 deletion app/code/core/Mage/Core/Block/Template/Zend.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ public function assign($key, $value = null)

/**
* @param string $dir
* @return void
* @return $this
*/
public function setScriptPath($dir)
{
$this->_view->setScriptPath($dir . DS);
return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function removeAccents($string, $german = false)
}

/**
* @param int|null $storeId
* @param null|string|bool|int|Mage_Core_Model_Store $storeId
* @return bool
*/
public function isDevAllowed($storeId = null)
Expand Down
8 changes: 6 additions & 2 deletions app/code/core/Mage/Core/Model/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ protected function _getStoreByWebsite($website)
/**
* Set current default store
*
* @param string $store
* @param null|string|bool|int|Mage_Core_Model_Store $store
* @return $this
*/
public function setCurrentStore($store)
Expand Down Expand Up @@ -936,7 +936,7 @@ protected function _getDefaultStore()
/**
* Retrieve default store for default group and website
*
* @return Mage_Core_Model_Store
* @return Mage_Core_Model_Store|null
*/
public function getDefaultStoreView()
{
Expand Down Expand Up @@ -1431,6 +1431,10 @@ public function getUpdateMode()
return $this->_updateMode;
}

/**
* @param string $text
* @throws Mage_Core_Model_Store_Exception
*/
public function throwStoreException($text = '')
{
throw new Mage_Core_Model_Store_Exception($text);
Expand Down
Loading

0 comments on commit 2bd4e09

Please sign in to comment.