Skip to content

Commit

Permalink
PHPStan: some fixes (#4346)
Browse files Browse the repository at this point in the history
* some fixes

- #4291 (comment)

* some fixes

* rector

* Update app/code/core/Mage/Paypal/Model/Payflowlink.php

Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com>

---------

Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com>
  • Loading branch information
sreichel and kiatng authored Nov 26, 2024
1 parent afa1346 commit c294b09
Show file tree
Hide file tree
Showing 95 changed files with 205 additions and 611 deletions.
590 changes: 10 additions & 580 deletions .phpstan.dist.baseline.neon

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions app/code/core/Mage/Payment/Model/Method/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,13 @@ public function getInfoBlockType()
/**
* Retrieve payment information model object
*
* @return Mage_Payment_Model_Info
* @return Mage_Sales_Model_Order_Payment|Mage_Sales_Model_Quote_Payment
*/
public function getInfoInstance()
{
/** @var Mage_Sales_Model_Order_Payment|Mage_Sales_Model_Quote_Payment $instance */
$instance = $this->getData('info_instance');
if (!($instance instanceof Mage_Payment_Model_Info)) {
if (!$instance instanceof Mage_Payment_Model_Info) {
Mage::throwException(Mage::helper('payment')->__('Cannot retrieve the payment information object instance.'));
}
return $instance;
Expand Down
3 changes: 1 addition & 2 deletions app/code/core/Mage/Paypal/Model/Payflowlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ protected function _getOrderFromResponse()
/**
* Build request for getting token
*
* @param Mage_Sales_Model_Order_Payment|Mage_Payment_Model_Info $payment
* @return Varien_Object
* @return Mage_Paypal_Model_Payflow_Request
*/
protected function _buildTokenRequest(Mage_Sales_Model_Order_Payment $payment)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface Mage_Reports_Model_Resource_Helper_Interface
* @param string $mainTable
* @param array $data
* @param mixed $matchFields
* @return string
* @return int
*/
public function mergeVisitorProductIndex($mainTable, $data, $matchFields);

Expand Down
10 changes: 5 additions & 5 deletions app/code/core/Mage/Sales/Model/Order/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public function place()
*
* TODO: eliminate logic duplication with registerCaptureNotification()
*
* @param Mage_Sales_Model_Order_Invoice $invoice
* @param Mage_Sales_Model_Order_Invoice|null $invoice
* @return $this
* @throws Mage_Core_Exception
*/
Expand Down Expand Up @@ -1252,7 +1252,7 @@ protected function _void($isOnline, $amount = null, $gatewayCallback = 'void')
* @param string $type
* @param Mage_Sales_Model_Abstract $salesDocument
* @param bool $failsafe
* @return null|Mage_Sales_Model_Order_Payment_Transaction
* @return null|Mage_Sales_Model_Order_Payment_Transaction|void
*/
protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
{
Expand Down Expand Up @@ -1414,7 +1414,7 @@ protected function _isTransactionExists($txnId = null)
/**
* Append transaction ID (if any) message to the specified message
*
* @param Mage_Sales_Model_Order_Payment_Transaction|null $transaction
* @param Mage_Sales_Model_Order_Payment_Transaction|string|null $transaction
* @param string $message
* @return string
*/
Expand Down Expand Up @@ -1480,7 +1480,7 @@ protected function _formatPrice($amount, $currency = null)

/**
* Find one transaction by ID or type
* @param string $txnId
* @param string|false|null $txnId
* @param string|false $txnType
* @return Mage_Sales_Model_Order_Payment_Transaction|false
*/
Expand Down Expand Up @@ -1519,7 +1519,7 @@ protected function _lookupTransaction($txnId, $txnType = false)

/**
* Find one transaction by ID or type
* @param string $txnId
* @param string|false $txnId
* @param string|false $txnType
* @return Mage_Sales_Model_Order_Payment_Transaction|false
*/
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/SalesRule/Model/Quote/Discount.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function _aggregateItemDiscount($item)
/**
* Add discount total information to address
*
* @return $this
* @return $this|array
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Weee/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function getAmount($product, $shipping = null, $billing = null, $website
/**
* Returns display type for price accordingly to current zone
*
* @param Mage_Catalog_Model_Product $product
* @param mixed $product
* @param array|int|null $compareTo
* @param string $zone
* @param Mage_Core_Model_Store $store
Expand Down Expand Up @@ -221,7 +221,7 @@ public function typeOfDisplay($product, $compareTo = null, $zone = null, $store
* @param Mage_Catalog_Model_Product $product
* @param null|false|Varien_Object $shipping
* @param null|false|Varien_Object $billing
* @param int|Mage_Core_Model_Website $website
* @param int|Mage_Core_Model_Website|null|string|true $website
* @param bool $calculateTaxes
* @return array
*/
Expand Down Expand Up @@ -301,7 +301,7 @@ public function getProductWeeeAttributesForDisplay($product)
* @param Mage_Catalog_Model_Product $product
* @param null|false|Varien_Object $shipping Shipping Address
* @param null|false|Varien_Object $billing Billing Address
* @param null|int $website
* @param int|Mage_Core_Model_Website|null|string|true $website
* @param mixed $calculateTaxes
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Weee/Model/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getWeeeTaxAttributeCodes($forceEnabled = false)
* @param Mage_Catalog_Model_Product $product
* @param Mage_Sales_Model_Quote_Address $shipping
* @param Mage_Sales_Model_Quote_Address $billing
* @param int|Mage_Core_Model_Website $website
* @param int|Mage_Core_Model_Website|null|string|true $website
* @param bool $calculateTax
* @param bool $ignoreDiscount
* @return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Template $this */
?>
<script type="text/javascript">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Permissions_Tab_Rolesusers $this */
?>
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Role Users') ?></h4>
<?php echo $this->_getGridHtml() ?>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Template $this */
?>
<script type="text/javascript">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Report_Refresh_Statistics $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Sales_Order_Shipment_Packaging $this */
?>

<div id="packed_window" style="display:none;" class="packed-window">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Sales_Order_Shipment_Packaging $this */
?>
<?php
$shippingMethod = $this->getShipment()->getOrder()->getShippingMethod();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_System_Design_Edit $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_System_Design $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2023 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_System_Email_Template_Edit $this */
?>
<div class="content-header">
<h3 class="icon-head head-system-email-template"><?php echo $this->getHeaderText() ?></h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_System_Email_Template $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Core_Block_Template $this */
?>
<?php echo $this->getChildHtml('content') ?>
<?php echo $this->getChildHtml('profiler') ?>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tag_Edit $this */
?>
<?php echo $this->getFormInitScripts() ?>
<div class="content-header">
Expand Down
2 changes: 2 additions & 0 deletions app/design/adminhtml/default/default/template/tag/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tag_Pending $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tax_Rate_ImportExport $this */
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tax_Rate_Form $this */
?>
<div class="entry-edit">
<?php echo $this->getFormHtml() ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tax_Rate_Title $this */
?>
<?php /* <table class="dynamic-grid" cellspacing="0" id="tax-rate-titles-table"> */ ?>
<tr class="dynamic-grid">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* @var Mage_Adminhtml_Block_Tax_Rate_Toolbar_Add $this
* @var string $header
*/
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* @var Mage_Adminhtml_Block_Tax_Rate_Toolbar_Save $this
* @var string $header
* @var Mage_Adminhtml_Block_Tax_Rate_Form $form
*/
?>
<div class="content-header">
<table cellspacing="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Adminhtml_Block_Tax_Rule_Edit_Form $this */
?>
<div class="entry-edit">
<?php echo $this->getFormHtml();?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php

/**
* Template for MAP popup
*
* @var Mage_Core_Block_Template $this
*/
?>
<?php if (Mage::helper('catalog')->isMsrpEnabled()): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Catalog_Block_Product_List_Related $this */
?>
<?php if($this->getItems()->getSize()): ?>
<div class="block block-related">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Catalog_Block_Product_List_Upsell $this */
?>
<?php if(count($this->getItemCollection()->getItems())): ?>
<div class="box-collateral box-up-sell">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Catalog_Block_Product_View $this */
?>

<?php $_product = $this->getProduct(); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Catalog_Block_Product_View $this */
?>
<?php $_product = $this->getProduct(); ?>
<?php $buttonTitle = $this->__('Add to Cart'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
?>
<?php
/**
* @see Mage_Catalog_Block_Seo_Sitemap_
* @var Mage_Catalog_Block_Seo_Sitemap_ $this
* @see Mage_Catalog_Block_Seo_Sitemap_Product
* @var Mage_Catalog_Block_Seo_Sitemap_Product $this
*/
?>
<?php $_items = $this->getCollection(); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_Page_Block_Template_Container $this */
?>
<div class="page-sitemap">
<div class="page-title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
?>
<?php
/**
* @see Mage_Catalog_Block_Seo_Sitemap_
* @var Mage_Catalog_Block_Seo_Sitemap_ $this
* @see Mage_Catalog_Block_Seo_Sitemap_Tree_Category
* @var Mage_Catalog_Block_Seo_Sitemap_Tree_Category $this
*/
?>
<?php $_items = $this->getCollection(); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* @copyright Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/** @var Mage_CatalogSearch_Block_Advanced_Result $this */
?>
<div class="page-title">
<h1><?php echo $this->__('Catalog Advanced Search') ?></h1>
Expand Down
Loading

0 comments on commit c294b09

Please sign in to comment.