Skip to content

Commit

Permalink
Merge branch 'main' into slugger
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/code/core/Mage/Catalog/Model/Category/Url.php
#	tests/unit/Mage/Catalog/Helper/Product/UrlTest.php
  • Loading branch information
sreichel committed Nov 28, 2024
2 parents cd4fbf2 + 0b965e9 commit c1a5d70
Show file tree
Hide file tree
Showing 86 changed files with 258 additions and 800 deletions.
577 changes: 1 addition & 576 deletions .phpstan.dist.baseline.neon

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,23 @@
DeadCode\ClassMethod\RemoveUselessReturnTagRector::class,
DeadCode\Property\RemoveUselessVarTagRector::class,
TypeDeclaration\ClassMethod\ReturnNeverTypeRector::class,
]);
])
->withPreparedSets(
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
false,
false,
false,
false,
true,
);
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public function getValidateButton()
$optionsVarName = $this->getJsVariablePrefix() . 'VatParameters';
$beforeHtml = '<script type="text/javascript">var ' . $optionsVarName . ' = ' . $vatValidateOptions
. ';</script>';
$this->_validateButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData([

/** @var Mage_Adminhtml_Block_Widget_Button $block */
$block = $this->getLayout()->createBlock('adminhtml/widget_button');
$this->_validateButton = $block->setData([
'label' => Mage::helper('customer')->__('Validate VAT Number'),
'before_html' => $beforeHtml,
'onclick' => 'order.validateVat(' . $optionsVarName . ')'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getAddressId()
/**
* Return address object
*
* @return Mage_Customer_Model_Address
* @return Mage_Sales_Model_Quote_Address
*/
public function getAddress()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected function _getExtraJs($element, $tooltipsExist = false)
* Collapsed or expanded fieldset when page loaded?
*
* @param Varien_Data_Form_Element_Abstract $element
* @return int|bool
* @return int|false
*/
protected function _getCollapseState($element)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Mage_Adminhtml_Block_Widget_Grid extends Mage_Adminhtml_Block_Widget
/**
* Collection object
*
* @var Mage_Core_Model_Resource_Db_Collection_Abstract|Varien_Data_Collection_Db|null
* @var Varien_Data_Collection_Db|null
*/
protected $_collection = null;

Expand Down
6 changes: 4 additions & 2 deletions app/code/core/Mage/Authorizenet/Model/Directpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function authorize(Varien_Object $payment, $amount)
/**
* Send capture request to gateway
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return $this
* @throws Mage_Core_Exception
Expand Down Expand Up @@ -221,6 +222,7 @@ public function refund(Varien_Object $payment, $amount)
/**
* refund the amount with transaction id
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $amount
* @return $this
* @throws Mage_Core_Exception
Expand Down Expand Up @@ -324,7 +326,7 @@ public function initialize($paymentAction, $stateObject)
switch ($paymentAction) {
case self::ACTION_AUTHORIZE:
case self::ACTION_AUTHORIZE_CAPTURE:
/** @var Mage_Authorizenet_Model_Directpost $payment */
/** @var Mage_Sales_Model_Order_Payment|Mage_Sales_Model_Quote_Payment $payment */
$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
Expand Down Expand Up @@ -639,7 +641,7 @@ protected function _captureOrder(Mage_Sales_Model_Order $order)
/**
* Return additional information`s transaction_id value of parent transaction model
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
* @return string
*/
protected function _getRealParentTransactionId($payment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function setDataFromOrder(Mage_Sales_Model_Order $order, Mage_Authorizene
*/
public function signRequestData()
{
$fpTimestamp = time();
$fpTimestamp = (string) time();
$signatureKey = $this->_getSignatureKey();
if (!empty($signatureKey)) {
$hash = $this->_generateSha2RequestSign(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function getOrderItem()
/**
* Retrieve Value HTML
*
* @param Mage_Sales_Model_Order_Item $item
* @param Mage_Sales_Model_Order_Invoice_Item $item
* @return string
*/
public function getValueHtml($item)
Expand All @@ -254,13 +254,13 @@ public function getValueHtml($item)
/**
* Can show price info for item
*
* @param Mage_Sales_Model_Order_Item $item
* @param Mage_Sales_Model_Order_Invoice_Item $item
* @return bool
*/
public function canShowPriceInfo($item)
{
if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
|| (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())
|| (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())
) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Block/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Mage_Catalog_Block_Navigation extends Mage_Core_Block_Template
/**
* Current category key
*
* @var string
* @var int|string
*/
protected $_currentCategoryKey;

Expand Down Expand Up @@ -94,7 +94,7 @@ public function getCacheKeyInfo()
/**
* Get current category key
*
* @return mixed
* @return int|string
*/
public function getCurrenCategoryKey()
{
Expand Down
6 changes: 4 additions & 2 deletions app/code/core/Mage/Catalog/Block/Product/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getAddToCompareUrl($product)
* Gets minimal sales quantity
*
* @param Mage_Catalog_Model_Product $product
* @return int|null
* @return float|null
*/
public function getMinimalQty($product)
{
Expand Down Expand Up @@ -317,7 +317,9 @@ protected function _initReviewsHelperBlock()
return false;
}

$this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');
/** @var Mage_Review_Block_Helper $block */
$block = $this->getLayout()->createBlock('review/helper');
$this->_reviewsHelperBlock = $block;
}

return true;
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template
/**
* List of available view types
*
* @var string
* @var array
*/
protected $_availableMode = [];

Expand Down Expand Up @@ -536,7 +536,7 @@ public function isModeActive($mode)
/**
* Retrieve availables view modes
*
* @return string
* @return array
*/
public function getModes()
{
Expand All @@ -551,7 +551,7 @@ public function getModes()
*/
public function setModes($modes)
{
if (!isset($this->_availableMode)) {
if (!$this->_availableMode) {
$this->_availableMode = $modes;
}
return $this;
Expand Down Expand Up @@ -650,7 +650,7 @@ public function getDefaultPerPageValue()
}
return Mage::getStoreConfig('catalog/frontend/grid_per_page');
}
return 0;
return '0';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Block/Product/New.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Mage_Catalog_Block_Product_New extends Mage_Catalog_Block_Product_Abstract
/**
* Products count
*
* @var null
* @var int
*/
protected $_productsCount;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function getTotalNum()
public function getLastPageNum()
{
if ($this->_lastPage === null) {
$this->_lastPage = ceil($this->getCollectionSize() / $this->getLimit());
$this->_lastPage = (int) ceil($this->getCollectionSize() / $this->getLimit());
if ($this->_lastPage <= 0) {
$this->_lastPage = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Block/Seo/Sitemap/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ protected function _prepareLayout()
*/
public function getItemUrl($product)
{
$helper = Mage::helper('catalog/product');
/** @var Mage_Catalog_Helper_Product $helper */
$helper = Mage::helper('catalog/product');
return $helper->getProductUrl($product);
}
}
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Mage_Catalog_Helper_Data extends Mage_Core_Helper_Abstract
/**
* Breadcrumb Path cache
*
* @var string|array<string, array<string, string|null>>
* @var array<string, array<string, string|null>>
*/
protected $_categoryPath;

Expand Down Expand Up @@ -79,7 +79,7 @@ public function setStoreId($store)
* Return current category path or get it from current category
* and creating array of categories|product paths for breadcrumbs
*
* @return string
* @return array
*/
public function getBreadcrumbPath()
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public function getSkipSaleableCheck()
* Gets minimal sales quantity
*
* @param Mage_Catalog_Model_Product $product
* @return int|null
* @return float|null
*/
public function getMinimalQty($product)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Api2/Product/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected function _getTierPrices()
/**
* Default implementation. May be different for customer/guest/admin role.
*
* @return null
* @return int|null
*/
protected function _getCustomerGroupId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ protected function _filterStockData(&$stockData)
* Filter out fields if Use Config Settings option used
*
* @param array $data
* @param string $fields
* @param array $fields
*/
protected function _filterConfigValueUsed(&$data, $fields)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Design.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function _apply($package, $theme)
* Apply custom design
*
* @param string $design
* @return null|false
* @return void|false
*/
public function applyCustomDesign($design)
{
Expand Down
16 changes: 12 additions & 4 deletions app/code/core/Mage/Catalog/Model/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ class Mage_Catalog_Model_Factory extends Mage_Core_Model_Factory
*/
public function getCategoryUrlRewriteHelper()
{
return $this->getHelper(
/** @var Mage_Catalog_Helper_Category_Url_Rewrite_Interface $model */
$model = $this->getHelper(
(string)$this->_config->getNode(self::XML_PATH_CATEGORY_URL_REWRITE_HELPER_CLASS)
);
return $model;
}

/**
Expand All @@ -59,9 +61,11 @@ public function getCategoryUrlRewriteHelper()
*/
public function getProductUrlRewriteHelper()
{
return $this->getHelper(
/** @var Mage_Catalog_Helper_Product_Url_Rewrite_Interface $model */
$model = $this->getHelper(
(string)$this->_config->getNode(self::XML_PATH_PRODUCT_URL_REWRITE_HELPER_CLASS)
);
return $model;
}

/**
Expand All @@ -71,9 +75,11 @@ public function getProductUrlRewriteHelper()
*/
public function getProductUrlInstance()
{
return $this->getModel(
/** @var Mage_Catalog_Model_Product_Url $model */
$model = $this->getModel(
(string)$this->_config->getNode(self::XML_PATH_PRODUCT_URL_MODEL)
);
return $model;
}

/**
Expand All @@ -83,8 +89,10 @@ public function getProductUrlInstance()
*/
public function getCategoryUrlInstance()
{
return $this->getModel(
/** @var Mage_Catalog_Model_Category_Url $model */
$model = $this->getModel(
(string)$this->_config->getNode(self::XML_PATH_CATEGORY_URL_MODEL)
);
return $model;
}
}
6 changes: 3 additions & 3 deletions app/code/core/Mage/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -1898,8 +1898,8 @@ public function addOption(Mage_Catalog_Model_Product_Option $option)
/**
* Get option from options array of product by given option id
*
* @param int $optionId
* @return Mage_Catalog_Model_Product_Option | null
* @param string $optionId
* @return Mage_Catalog_Model_Product_Option|null
*/
public function getOptionById($optionId)
{
Expand Down Expand Up @@ -1997,7 +1997,7 @@ public function hasCustomOptions()
* Check availability display product in category
*
* @param int $categoryId
* @return bool
* @return string
*/
public function canBeShowInCategory($categoryId)
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Model/Product/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public function delete($productId, $identifierType = null)
/**
* Get list of additional attributes which are not in default create/update list
*
* @param int $productType
* @param string $productType
* @param int $attributeSetId
* @return array
*/
Expand Down Expand Up @@ -429,7 +429,7 @@ public function getAdditionalAttributes($productType, $attributeSetId)
/**
* Check if product type exists
*
* @param int $productType
* @param string $productType
* @throw Mage_Api_Exception
*/
protected function _checkProductTypeExists($productType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function _calcSelectionPrice($priceInfo, $productPrice)
/**
* @param array $values
* @param string $index
* @return bool
* @return array|false
*/
protected function _getValueByIndex($values, $index)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Resource/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function deleteEntity(Mage_Core_Model_Abstract $object)
* Defines is Attribute used by super products
*
* @param int $attributeSet
* @return int
* @return false|string|null
*/
public function isUsedBySuperProducts(Mage_Core_Model_Abstract $object, $attributeSet = null)
{
Expand Down
Loading

0 comments on commit c1a5d70

Please sign in to comment.