Skip to content

Commit 4b6ad39

Browse files
sreichelkiatng
andauthored
PhpStan: some fixes (OpenMage#4363)
* phpstan * No new/modified lines in baseline * add "methods" --------- Co-authored-by: Ng Kiat Siong <[email protected]>
1 parent 71e1479 commit 4b6ad39

File tree

66 files changed

+145
-695
lines changed

Some content is hidden

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

66 files changed

+145
-695
lines changed

.phpstan.dist.baseline.neon

Lines changed: 1 addition & 581 deletions
Large diffs are not rendered by default.

app/code/core/Mage/Adminhtml/Block/Customer/Sales/Order/Address/Form/Renderer/Vat.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ public function getValidateButton()
7575
$optionsVarName = $this->getJsVariablePrefix() . 'VatParameters';
7676
$beforeHtml = '<script type="text/javascript">var ' . $optionsVarName . ' = ' . $vatValidateOptions
7777
. ';</script>';
78-
$this->_validateButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setData([
78+
79+
/** @var Mage_Adminhtml_Block_Widget_Button $block */
80+
$block = $this->getLayout()->createBlock('adminhtml/widget_button');
81+
$this->_validateButton = $block->setData([
7982
'label' => Mage::helper('customer')->__('Validate VAT Number'),
8083
'before_html' => $beforeHtml,
8184
'onclick' => 'order.validateVat(' . $optionsVarName . ')'

app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Shipping/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function getAddressId()
112112
/**
113113
* Return address object
114114
*
115-
* @return Mage_Customer_Model_Address
115+
* @return Mage_Sales_Model_Quote_Address
116116
*/
117117
public function getAddress()
118118
{

app/code/core/Mage/Adminhtml/Block/System/Config/Form/Fieldset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ protected function _getExtraJs($element, $tooltipsExist = false)
183183
* Collapsed or expanded fieldset when page loaded?
184184
*
185185
* @param Varien_Data_Form_Element_Abstract $element
186-
* @return int|bool
186+
* @return int|false
187187
*/
188188
protected function _getCollapseState($element)
189189
{

app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Mage_Adminhtml_Block_Widget_Grid extends Mage_Adminhtml_Block_Widget
4646
/**
4747
* Collection object
4848
*
49-
* @var Mage_Core_Model_Resource_Db_Collection_Abstract|Varien_Data_Collection_Db|null
49+
* @var Varien_Data_Collection_Db|null
5050
*/
5151
protected $_collection = null;
5252

app/code/core/Mage/Authorizenet/Model/Directpost.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function authorize(Varien_Object $payment, $amount)
6767
/**
6868
* Send capture request to gateway
6969
*
70+
* @param Mage_Sales_Model_Order_Payment $payment
7071
* @param float $amount
7172
* @return $this
7273
* @throws Mage_Core_Exception
@@ -221,6 +222,7 @@ public function refund(Varien_Object $payment, $amount)
221222
/**
222223
* refund the amount with transaction id
223224
*
225+
* @param Mage_Sales_Model_Order_Payment $payment
224226
* @param string $amount
225227
* @return $this
226228
* @throws Mage_Core_Exception
@@ -324,7 +326,7 @@ public function initialize($paymentAction, $stateObject)
324326
switch ($paymentAction) {
325327
case self::ACTION_AUTHORIZE:
326328
case self::ACTION_AUTHORIZE_CAPTURE:
327-
/** @var Mage_Authorizenet_Model_Directpost $payment */
329+
/** @var Mage_Sales_Model_Order_Payment|Mage_Sales_Model_Quote_Payment $payment */
328330
$payment = $this->getInfoInstance();
329331
$order = $payment->getOrder();
330332
$order->setCanSendNewEmailFlag(false);
@@ -639,7 +641,7 @@ protected function _captureOrder(Mage_Sales_Model_Order $order)
639641
/**
640642
* Return additional information`s transaction_id value of parent transaction model
641643
*
642-
* @param Mage_Sales_Model_Order_Payment $payment
644+
* @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
643645
* @return string
644646
*/
645647
protected function _getRealParentTransactionId($payment)

app/code/core/Mage/Authorizenet/Model/Directpost/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function setDataFromOrder(Mage_Sales_Model_Order $order, Mage_Authorizene
163163
*/
164164
public function signRequestData()
165165
{
166-
$fpTimestamp = time();
166+
$fpTimestamp = (string) time();
167167
$signatureKey = $this->_getSignatureKey();
168168
if (!empty($signatureKey)) {
169169
$hash = $this->_generateSha2RequestSign(

app/code/core/Mage/Bundle/Model/Sales/Order/Pdf/Items/Abstract.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function getOrderItem()
230230
/**
231231
* Retrieve Value HTML
232232
*
233-
* @param Mage_Sales_Model_Order_Item $item
233+
* @param Mage_Sales_Model_Order_Invoice_Item $item
234234
* @return string
235235
*/
236236
public function getValueHtml($item)
@@ -254,13 +254,13 @@ public function getValueHtml($item)
254254
/**
255255
* Can show price info for item
256256
*
257-
* @param Mage_Sales_Model_Order_Item $item
257+
* @param Mage_Sales_Model_Order_Invoice_Item $item
258258
* @return bool
259259
*/
260260
public function canShowPriceInfo($item)
261261
{
262262
if (($item->getOrderItem()->getParentItem() && $this->isChildCalculated())
263-
|| (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())
263+
|| (!$item->getOrderItem()->getParentItem() && !$this->isChildCalculated())
264264
) {
265265
return true;
266266
}

app/code/core/Mage/Catalog/Block/Navigation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Mage_Catalog_Block_Navigation extends Mage_Core_Block_Template
3232
/**
3333
* Current category key
3434
*
35-
* @var string
35+
* @var int|string
3636
*/
3737
protected $_currentCategoryKey;
3838

@@ -94,7 +94,7 @@ public function getCacheKeyInfo()
9494
/**
9595
* Get current category key
9696
*
97-
* @return mixed
97+
* @return int|string
9898
*/
9999
public function getCurrenCategoryKey()
100100
{

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function getAddToCompareUrl($product)
167167
* Gets minimal sales quantity
168168
*
169169
* @param Mage_Catalog_Model_Product $product
170-
* @return int|null
170+
* @return float|null
171171
*/
172172
public function getMinimalQty($product)
173173
{
@@ -317,7 +317,9 @@ protected function _initReviewsHelperBlock()
317317
return false;
318318
}
319319

320-
$this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');
320+
/** @var Mage_Review_Block_Helper $block */
321+
$block = $this->getLayout()->createBlock('review/helper');
322+
$this->_reviewsHelperBlock = $block;
321323
}
322324

323325
return true;

0 commit comments

Comments
 (0)