From d033c75dd14f23e958b1a43e45c3cdeccaea7b7a Mon Sep 17 00:00:00 2001 From: sv3n Date: Mon, 12 Sep 2022 22:06:51 +0200 Subject: [PATCH] PHPStan: fixed "Access to an undefined property" (#2554) --- .github/phpstan-baseline.neon | 310 ------------------ .../Block/Catalog/Category/Tab/Design.php | 14 + .../Block/Customer/Edit/Tab/Cart.php | 23 +- .../Mage/Adminhtml/Block/Dashboard/Bar.php | 15 +- .../Mage/Adminhtml/Block/Dashboard/Graph.php | 11 +- .../Template/Grid/Renderer/Action.php | 2 +- .../core/Mage/Adminhtml/Block/Report/Grid.php | 23 +- .../Adminhtml/Block/Report/Grid/Abstract.php | 7 + .../System/Convert/Gui/Edit/Tab/Wizard.php | 91 ++++- .../Mage/Adminhtml/Block/Tag/Customer.php | 4 + .../Adminhtml/Block/Widget/Grid/Container.php | 29 ++ .../Catalog/Model/Resource/Category/Tree.php | 8 +- .../Mage/Eav/Model/Convert/Adapter/Grid.php | 5 + .../core/Mage/Paygate/Model/Authorizenet.php | 21 +- .../core/Mage/Paypal/Block/Express/Review.php | 5 + .../Paypal/Controller/Express/Abstract.php | 15 + app/code/core/Mage/Paypal/Model/Config.php | 27 ++ .../Mage/Sales/Model/Quote/Item/Abstract.php | 5 + .../Sales/Model/Resource/Sale/Collection.php | 9 +- .../Mage/Shipping/Model/Carrier/Abstract.php | 14 + 20 files changed, 280 insertions(+), 358 deletions(-) diff --git a/.github/phpstan-baseline.neon b/.github/phpstan-baseline.neon index bafd0db7d76..b65a24157ed 100644 --- a/.github/phpstan-baseline.neon +++ b/.github/phpstan-baseline.neon @@ -35,11 +35,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Api/Tab/Userroles.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Catalog_Category_Tab_Design\\:\\:\\$_category\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php - - message: "#^Cannot call method addAttributeToSelect\\(\\) on Mage_Core_Model_Resource_Db_Collection_Abstract\\|false\\.$#" count: 1 @@ -135,31 +130,11 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Customer_Edit_Tab_Cart\\:\\:\\$_parentTemplate\\.$#" - count: 2 - path: ../app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php - - message: "#^Method Mage_Wishlist_Model_Resource_Item_Collection\\:\\:addDaysInWishlist\\(\\) invoked with 1 parameter, 0 required\\.$#" count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Dashboard_Bar\\:\\:\\$_currency\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php - - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Dashboard_Graph\\:\\:\\$_max\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php - - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Dashboard_Graph\\:\\:\\$_min\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php - - message: "#^Variable \\$d might not be defined\\.$#" count: 2 @@ -235,21 +210,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Poll/Answer/Edit.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Report_Grid\\:\\:\\$_filterValues\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Report/Grid.php - - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Report_Grid\\:\\:\\$_locale\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Report/Grid.php - - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Report_Grid_Abstract\\:\\:\\$_columnGroupBy\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php - - message: "#^Call to an undefined method Mage_Reports_Model_Resource_Report_Collection_Abstract\\:\\:addOrderStatusFilter\\(\\)\\.$#" count: 1 @@ -360,11 +320,6 @@ parameters: count: 2 path: ../app/code/core/Mage/Adminhtml/Block/System/Config/Form.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Wizard\\:\\:\\$_filterStores\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php - - message: "#^Variable \\$attributes might not be defined\\.$#" count: 1 @@ -440,21 +395,11 @@ parameters: count: 15 path: ../app/code/core/Mage/Adminhtml/Block/System/Store/Edit/Form.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Tag_Customer\\:\\:\\$_block\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Tag/Customer.php - - message: "#^Call to an undefined method Mage_Tag_Model_Resource_Tag_Collection\\:\\:addAttributeToFilter\\(\\)\\.$#" count: 1 path: ../app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php - - - message: "#^Access to an undefined property Mage_Adminhtml_Block_Tag_Product\\:\\:\\$_block\\.$#" - count: 1 - path: ../app/code/core/Mage/Adminhtml/Block/Tag/Product.php - - message: "#^Binary operation \"\\*\" between string and 1 results in an error\\.$#" count: 1 @@ -1410,11 +1355,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Catalog/Model/Resource/Category/Indexer/Product.php - - - message: "#^Access to an undefined property Mage_Catalog_Model_Resource_Category_Tree\\:\\:\\$_inactiveItems\\.$#" - count: 2 - path: ../app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php - - message: "#^Call to an undefined method Zend_Db_Adapter_Abstract\\:\\:getCheckSql\\(\\)\\.$#" count: 2 @@ -2235,11 +2175,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Eav/Model/Convert/Adapter/Entity.php - - - message: "#^Access to an undefined property Mage_Eav_Model_Convert_Adapter_Grid\\:\\:\\$_entityType\\.$#" - count: 1 - path: ../app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php - - message: "#^Binary operation \"\\.\" between Mage_Eav_Model_Entity_Interface and '_collection' results in an error\\.$#" count: 1 @@ -2650,11 +2585,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paygate/Helper/Data.php - - - message: "#^Access to an undefined property Mage_Paygate_Model_Authorizenet\\:\\:\\$_cardsStorage\\.$#" - count: 2 - path: ../app/code/core/Mage/Paygate/Model/Authorizenet.php - - message: "#^Variable \\$defaultExceptionMessage might not be defined\\.$#" count: 2 @@ -2700,86 +2630,16 @@ parameters: count: 1 path: ../app/code/core/Mage/Payment/Model/Recurring/Profile.php - - - message: "#^Access to an undefined property Mage_Paypal_Block_Express_Review\\:\\:\\$_address\\.$#" - count: 2 - path: ../app/code/core/Mage/Paypal/Block/Express/Review.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$visible_on_cart\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Block/Express/Shortcut.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$visible_on_product\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Block/Express/Shortcut.php - - message: "#^Method Mage_Paypal_Block_Payment_Info\\:\\:getCcTypeName\\(\\) should return string\\|null but return statement is missing\\.$#" count: 1 path: ../app/code/core/Mage/Paypal/Block/Payment/Info.php - - - message: "#^Access to an undefined property Mage_Paypal_Controller_Express_Abstract\\:\\:\\$_checkoutType\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Controller/Express/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Controller_Express_Abstract\\:\\:\\$_configMethod\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Controller/Express/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Controller_Express_Abstract\\:\\:\\$_configType\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Controller/Express/Abstract.php - - message: "#^Variable \\$isAjax might not be defined\\.$#" count: 1 path: ../app/code/core/Mage/Paypal/Controller/Express/Abstract.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$sandboxFlag\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Helper/Data.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$apiAuthentication\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$apiPassword\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$apiSignature\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$apiUsername\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$debug\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Abstract.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$sandboxFlag\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Nvp.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$verifyPeer\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Api/Nvp.php - - message: "#^Call to an undefined method Mage_Paypal_Model_Api_Nvp\\:\\:_export\\(\\)\\.$#" count: 1 @@ -2795,66 +2655,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Cart.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$allow_ba_signup\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$api_cert\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$api_password\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$api_signature\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$api_username\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$businessAccount\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$business_account\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$buttonFlavor\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$buttonType\\.$#" - count: 2 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentAction\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentMarkSize\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$sandboxFlag\\.$#" - count: 3 - path: ../app/code/core/Mage/Paypal/Model/Config.php - - message: "#^Default value of the parameter \\#2 \\$type \\(false\\) of method Mage_Paypal_Model_Config\\:\\:getAdditionalOptionsLogoUrl\\(\\) is incompatible with type string\\.$#" count: 1 @@ -2870,66 +2670,11 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Config.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$cctypes\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Direct.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Direct.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentAction\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Direct.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentAction\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express.php - - message: "#^Call to an undefined method Mage_Payment_Model_Info\\:\\:lookupTransaction\\(\\)\\.$#" count: 2 path: ../app/code/core/Mage/Paypal/Model/Express.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$allow_ba_signup\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#" - count: 2 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentAction\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$requireBillingAddress\\.$#" - count: 4 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$solutionType\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$transferShippingOptions\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Express/Checkout.php - - message: "#^Cannot call method getData\\(\\) on array\\.$#" count: 2 @@ -2955,36 +2700,11 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Hostedpro.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$businessAccount\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Ipn.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$debug\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Ipn.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$verifyPeer\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Ipn.php - - message: "#^Binary operation \"\\-\" between array\\|string and array\\|string results in an error\\.$#" count: 1 path: ../app/code/core/Mage/Paypal/Model/Ipn.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Method/Agreement.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$paymentAction\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Method/Agreement.php - - message: "#^Method Mage_Paypal_Model_Observer\\:\\:fetchReports\\(\\) should return \\$this\\(Mage_Paypal_Model_Observer\\) but return statement is missing\\.$#" count: 1 @@ -3005,16 +2725,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Paypal/Model/Pro.php - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsEnabled\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Standard.php - - - - message: "#^Access to an undefined property Mage_Paypal_Model_Config\\:\\:\\$lineItemsSummary\\.$#" - count: 1 - path: ../app/code/core/Mage/Paypal/Model/Standard.php - - message: "#^Method Mage_Paypal_Model_Standard\\:\\:initialize\\(\\) should return \\$this\\(Mage_Paypal_Model_Standard\\) but return statement is missing\\.$#" count: 1 @@ -3285,11 +2995,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Sales/Model/Quote/Item.php - - - message: "#^Access to an undefined property Mage_Sales_Model_Quote_Item_Abstract\\:\\:\\$_optionsByCode\\.$#" - count: 1 - path: ../app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php - - message: "#^Call to an undefined method Mage_Payment_Model_Method_Abstract\\:\\:canGetRecurringProfileDetails\\(\\)\\.$#" count: 1 @@ -3330,11 +3035,6 @@ parameters: count: 1 path: ../app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers/Collection.php - - - message: "#^Access to an undefined property Mage_Sales_Model_Resource_Sale_Collection\\:\\:\\$_orderStateValue\\.$#" - count: 2 - path: ../app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php - - message: "#^Call to an undefined method Varien_Db_Adapter_Interface\\:\\:listTables\\(\\)\\.$#" count: 1 @@ -3370,16 +3070,6 @@ parameters: count: 2 path: ../app/code/core/Mage/SalesRule/Model/Validator.php - - - message: "#^Access to an undefined property Mage_Shipping_Model_Carrier_Abstract\\:\\:\\$_rawRequest\\.$#" - count: 1 - path: ../app/code/core/Mage/Shipping/Model/Carrier/Abstract.php - - - - message: "#^Access to an undefined property Mage_Shipping_Model_Carrier_Abstract\\:\\:\\$_result\\.$#" - count: 1 - path: ../app/code/core/Mage/Shipping/Model/Carrier/Abstract.php - - message: "#^Call to an undefined method Mage_Shipping_Model_Carrier_Abstract\\:\\:_getQuotes\\(\\)\\.$#" count: 1 diff --git a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php index cf414ffa7af..63473fc2d83 100644 --- a/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php +++ b/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Design.php @@ -25,12 +25,23 @@ */ class Mage_Adminhtml_Block_Catalog_Category_Tab_Design extends Mage_Adminhtml_Block_Catalog_Form { + /** + * @var Mage_Catalog_Model_Category + */ + protected $_category; + + /** + * Mage_Adminhtml_Block_Catalog_Category_Tab_Design constructor. + */ public function __construct() { parent::__construct(); $this->setShowGlobalIcon(true); } + /** + * @return Mage_Catalog_Model_Category + */ public function getCategory() { if (!$this->_category) { @@ -39,6 +50,9 @@ public function getCategory() return $this->_category; } + /** + * @return $this + */ public function _prepareLayout() { parent::_prepareLayout(); diff --git a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php index e2ae065ac55..6823b342aa8 100644 --- a/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php +++ b/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Cart.php @@ -27,6 +27,15 @@ */ class Mage_Adminhtml_Block_Customer_Edit_Tab_Cart extends Mage_Adminhtml_Block_Widget_Grid { + /** + * @var string + */ + protected $_parentTemplate; + + /** + * Mage_Adminhtml_Block_Customer_Edit_Tab_Cart constructor. + * @param array $attributes + */ public function __construct($attributes= []) { parent::__construct($attributes); @@ -58,8 +67,7 @@ protected function _prepareCollection() if ($quote) { $collection = $quote->getItemsCollection(false); - } - else { + } else { $collection = new Varien_Data_Collection(); } @@ -147,14 +155,21 @@ public function getCustomer() { return Mage::registry('current_customer'); } + /** + * @return string + */ public function getGridUrl() { - return $this->getUrl('*/*/cart', ['_current'=>true, 'website_id' => $this->getWebsiteId()]); + return $this->getUrl('*/*/cart', ['_current' => true, 'website_id' => $this->getWebsiteId()]); } + /** + * @return string + * @throws Exception + */ public function getGridParentHtml() { - $templateName = Mage::getDesign()->getTemplateFilename($this->_parentTemplate, ['_relative'=>true]); + $templateName = Mage::getDesign()->getTemplateFilename($this->_parentTemplate, ['_relative' => true]); return $this->fetchView($templateName); } diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php index 04026f42881..46b75519d07 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php @@ -30,6 +30,11 @@ class Mage_Adminhtml_Block_Dashboard_Bar extends Mage_Adminhtml_Block_Dashboard_ protected $_totals = []; protected $_currentCurrencyCode = null; + /** + * @var Mage_Directory_Model_Currency + */ + protected $_currency; + protected function _construct() { parent::_construct(); @@ -43,14 +48,6 @@ protected function getTotals() public function addTotal($label, $value, $isQuantity=false) { - /*if (!$isQuantity) { - $value = $this->format($value); - $decimals = substr($value, -2); - $value = substr($value, 0, -2); - } else { - $value = ($value != '')?$value:0; - $decimals = ''; - }*/ if (!$isQuantity) { $value = $this->format($value); } @@ -98,7 +95,7 @@ public function getCurrency() } else if ($this->getRequest()->getParam('website')){ $this->_currentCurrencyCode = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getBaseCurrency(); } else if ($this->getRequest()->getParam('group')){ - $this->_currentCurrencyCode = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getWebsite()->getBaseCurrency(); + $this->_currentCurrencyCode = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getWebsite()->getBaseCurrency(); } else { $this->_currentCurrencyCode = Mage::app()->getStore()->getBaseCurrency(); } diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php index bd8b2021681..30a6f2f0469 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php @@ -104,6 +104,9 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar */ protected $_htmlId = ''; + protected $_max; + protected $_min; + /** * Initialize object */ @@ -368,14 +371,14 @@ public function getChartUrl($directUrl = true) $valueBuffer[] = $indexid . ":|" . $tmpstring; if (count($this->_axisLabels[$idx]) > 1) { - $deltaX = 100/(count($this->_axisLabels[$idx])-1); + $deltaX = 100 / (count($this->_axisLabels[$idx]) - 1); } else { $deltaX = 100; } } else if ($idx === 'y') { $valueBuffer[] = $indexid . ":|" . implode('|', $yLabels); - if (count($yLabels)-1) { - $deltaY = 100/(count($yLabels)-1); + if (count($yLabels) - 1) { + $deltaY = 100 / (count($yLabels) - 1); } else { $deltaY = 100; } @@ -473,7 +476,7 @@ protected function _getPow($number) { $pow = 0; while ($number >= 10) { - $number = $number/10; + $number = $number / 10; $pow++; } return $pow; diff --git a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php index 12904adebaa..ab78acc0035 100644 --- a/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php @@ -35,7 +35,7 @@ class Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Action extends Mage */ public function render(Varien_Object $row) { - if($row->isValidForSend()) { + if ($row->isValidForSend()) { $actions[] = [ 'url' => $this->getUrl('*/newsletter_queue/edit', ['template_id' => $row->getId()]), 'caption' => Mage::helper('newsletter')->__('Queue Newsletter...') diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php index 42e29250040..f5a60ef3036 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php @@ -56,6 +56,17 @@ class Mage_Adminhtml_Block_Report_Grid extends Mage_Adminhtml_Block_Widget_Grid */ protected $_currentCurrencyCode = null; + /** + * @var Mage_Core_Model_Locale + */ + protected $_locale; + + /** @todo OM: check */ + protected $_filterValues; + + /** + * Mage_Adminhtml_Block_Report_Grid constructor. + */ public function __construct() { parent::__construct(); @@ -185,16 +196,18 @@ protected function _prepareCollection() $this->setCollection($collection); Mage::dispatchEvent('adminhtml_widget_grid_filter_collection', - ['collection' => $this->getCollection(), 'filter_values' => $this->_filterValues] + ['collection' => $this->getCollection(), 'filter_values' => $this->_filterValues] ); } + /** + * @param array $data + * @return $this + */ protected function _setFilterValues($data) { foreach ($data as $name => $value) { - //if (isset($data[$name])) { - $this->setFilter($name, $data[$name]); - //} + $this->setFilter($name, $data[$name]); } return $this; } @@ -521,7 +534,7 @@ public function getExcel($filename = '') foreach ($this->_columns as $column) { $j++; if (!$column->getIsSystem()) { - $row[] = ($j==1)?$this->__('Subtotal'):$column->getRowField($this->getTotals()); + $row[] = ($j == 1)?$this->__('Subtotal'):$column->getRowField($this->getTotals()); } } $data[] = $row; diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php index e07826f5f13..3ea5e06966c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid/Abstract.php @@ -30,6 +30,13 @@ class Mage_Adminhtml_Block_Report_Grid_Abstract extends Mage_Adminhtml_Block_Wid protected $_storeIds = []; protected $_aggregatedColumns = null; + /** + * Column for grid to be grouped by + * + * @var string + */ + protected $_columnGroupBy; + /** * Mage_Adminhtml_Block_Report_Grid_Abstract constructor. */ diff --git a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php index bf982630a27..bf707d69ca1 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php @@ -33,12 +33,23 @@ class Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Wizard extends Mage_Admin protected $_removeMapButtonHtml; protected $_shortDateFormat; + /** + * @var array + */ + protected $_filterStores; + + /** + * Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Wizard constructor. + */ public function __construct() { parent::__construct(); $this->setTemplate('system/convert/profile/wizard.phtml'); } + /** + * @return $this + */ protected function _prepareLayout() { if ($head = $this->getLayout()->getBlock('head')) { @@ -47,6 +58,10 @@ protected function _prepareLayout() return $this; } + /** + * @param string $entityType + * @return array|string[] + */ public function getAttributes($entityType) { if (!isset($this->_attributes[$entityType])) { @@ -62,13 +77,19 @@ public function getAttributes($entityType) break; } - array_splice($attributes, 0, 0, [''=>$this->__('Choose an attribute')]); + array_splice($attributes, 0, 0, ['' => $this->__('Choose an attribute')]); $this->_attributes[$entityType] = $attributes; } return $this->_attributes[$entityType]; } - public function getValue($key, $default='', $defaultNew = null) + /** + * @param string $key + * @param string $default + * @param string|null $defaultNew + * @return string + */ + public function getValue($key, $default = '', $defaultNew = null) { if ($defaultNew !== null) { if ($this->getProfileId() == 0) { @@ -80,9 +101,14 @@ public function getValue($key, $default='', $defaultNew = null) return $this->escapeHtml(strlen($value) > 0 ? $value : $default); } + /** + * @param string $key + * @param string $value + * @return string + */ public function getSelected($key, $value) { - return $this->getData($key)==$value ? 'selected="selected"' : ''; + return $this->getData($key) == $value ? 'selected="selected"' : ''; } public function getChecked($key) @@ -90,12 +116,19 @@ public function getChecked($key) return $this->getData($key) ? 'checked="checked"' : ''; } + /** + * @param string $entityType + * @return array + */ public function getMappings($entityType) { $maps = $this->getData('gui_data/map/'.$entityType.'/db'); - return $maps ? $maps : []; + return $maps ?: []; } + /** + * @return string + */ public function getAddMapButtonHtml() { if (!$this->_addMapButtonHtml) { @@ -106,6 +139,9 @@ public function getAddMapButtonHtml() return $this->_addMapButtonHtml; } + /** + * @return string + */ public function getRemoveMapButtonHtml() { if (!$this->_removeMapButtonHtml) { @@ -116,6 +152,9 @@ public function getRemoveMapButtonHtml() return $this->_removeMapButtonHtml; } + /** + * @return array + */ public function getProductTypeFilterOptions() { $options = Mage::getSingleton('catalog/product_type')->getOptionArray(); @@ -123,6 +162,9 @@ public function getProductTypeFilterOptions() return $options; } + /** + * @return array + */ public function getProductAttributeSetFilterOptions() { $options = Mage::getResourceModel('eav/entity_attribute_set_collection') @@ -130,46 +172,52 @@ public function getProductAttributeSetFilterOptions() ->load() ->toOptionHash(); - $opt = []; $opt = [''=>$this->__('Any Attribute Set')]; - if ($options) foreach($options as $index => $value) { - $opt[$index] = $value; + if ($options) { + foreach ($options as $index => $value) { + $opt[$index] = $value; + } } - //array_slice($options, 0, 0, array(''=>$this->__('Any Attribute Set'))); return $opt; } + /** + * @return array + */ public function getProductVisibilityFilterOptions() { $options = Mage::getSingleton('catalog/product_visibility')->getOptionArray(); - array_splice($options, 0, 0, [''=>$this->__('Any Visibility')]); return $options; } + /** + * @return array + */ public function getProductStatusFilterOptions() { $options = Mage::getSingleton('catalog/product_status')->getOptionArray(); - array_splice($options, 0, 0, [''=>$this->__('Any Status')]); return $options; } + /** + * @return array + */ public function getStoreFilterOptions() { if (!$this->_filterStores) { - #$this->_filterStores = array(''=>$this->__('Any Store')); $this->_filterStores = []; foreach (Mage::getConfig()->getNode('stores')->children() as $storeNode) { - if ($storeNode->getName()==='default') { - //continue; - } $this->_filterStores[$storeNode->getName()] = (string)$storeNode->system->store->name; } } return $this->_filterStores; } + /** + * @return array + */ public function getCustomerGroupFilterOptions() { $options = Mage::getResourceModel('customer/group_collection') @@ -181,6 +229,9 @@ public function getCustomerGroupFilterOptions() return $options; } + /** + * @return array + */ public function getCountryFilterOptions() { $options = Mage::getResourceModel('directory/country_collection') @@ -201,21 +252,33 @@ protected function _getStoreModel() { return $this->_storeModel; } + /** + * @return array + */ public function getWebsiteCollection() { return $this->_getStoreModel()->getWebsiteCollection(); } + /** + * @return array + */ public function getGroupCollection() { return $this->_getStoreModel()->getGroupCollection(); } + /** + * @return array + */ public function getStoreCollection() { return $this->_getStoreModel()->getStoreCollection(); } + /** + * @return string + */ public function getShortDateFormat() { if (!$this->_shortDateFormat) { diff --git a/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php b/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php index 5e09fda7346..aa62c56e60b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php +++ b/app/code/core/Mage/Adminhtml/Block/Tag/Customer.php @@ -27,6 +27,10 @@ */ class Mage_Adminhtml_Block_Tag_Customer extends Mage_Adminhtml_Block_Widget_Grid_Container { + /** + * Mage_Adminhtml_Block_Tag_Customer constructor. + * @throws Exception + */ public function __construct() { parent::__construct(); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php index ed127c5daee..7ec9e5df7f1 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php @@ -31,6 +31,14 @@ class Mage_Adminhtml_Block_Widget_Grid_Container extends Mage_Adminhtml_Block_Wi protected $_backButtonLabel; protected $_blockGroup = 'adminhtml'; + /** + * @var string + */ + protected $_block; + + /** + * Mage_Adminhtml_Block_Widget_Grid_Container constructor. + */ public function __construct() { if (is_null($this->_addButtonLabel)) { @@ -51,6 +59,9 @@ public function __construct() ]); } + /** + * @inheritdoc + */ protected function _prepareLayout() { $this->setChild( 'grid', @@ -59,21 +70,33 @@ protected function _prepareLayout() return parent::_prepareLayout(); } + /** + * @return string + */ public function getCreateUrl() { return $this->getUrl('*/*/new'); } + /** + * @return string + */ public function getGridHtml() { return $this->getChildHtml('grid'); } + /** + * @return string + */ protected function getAddButtonLabel() { return $this->_addButtonLabel; } + /** + * @return string + */ protected function getBackButtonLabel() { return $this->_backButtonLabel; @@ -88,11 +111,17 @@ protected function _addBackButton() ]); } + /** + * @return string + */ public function getHeaderCssClass() { return 'icon-head ' . parent::getHeaderCssClass(); } + /** + * @return string + */ public function getHeaderWidth() { return 'width:50%;'; diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php index 439840f5b97..c669a6c4178 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php @@ -67,9 +67,13 @@ class Mage_Catalog_Model_Resource_Category_Tree extends Varien_Data_Tree_Dbp */ protected $_storeId = null; + /** + * @var array + */ + protected $_inactiveItems; + /** * Initialize tree - * */ public function __construct() { @@ -359,8 +363,8 @@ public function setCollection($collection) protected function _getDefaultCollection($sorted = false) { $this->_joinUrlRewriteIntoCollection = true; - $collection = Mage::getModel('catalog/category')->getCollection(); /** @var Mage_Catalog_Model_Resource_Category_Collection $collection */ + $collection = Mage::getModel('catalog/category')->getCollection(); $attributes = Mage::getConfig()->getNode('frontend/category/collection/attributes'); if ($attributes) { diff --git a/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php b/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php index 109658a8349..bfc8645343f 100644 --- a/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php +++ b/app/code/core/Mage/Eav/Model/Convert/Adapter/Grid.php @@ -31,6 +31,11 @@ class Mage_Eav_Model_Convert_Adapter_Grid extends Mage_Dataflow_Model_Convert_Ad { protected $_entity; + /** + * @var string + */ + protected $_entityType; + /** * @return Mage_Eav_Model_Entity_Interface */ diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet.php b/app/code/core/Mage/Paygate/Model/Authorizenet.php index d78754af74e..0749157a837 100644 --- a/app/code/core/Mage/Paygate/Model/Authorizenet.php +++ b/app/code/core/Mage/Paygate/Model/Authorizenet.php @@ -105,22 +105,29 @@ class Mage_Paygate_Model_Authorizenet extends Mage_Payment_Model_Method_Cc protected $_canUseInternal = true; protected $_canUseCheckout = true; protected $_canUseForMultishipping = true; - protected $_canSaveCc = false; + protected $_canSaveCc = false; protected $_canFetchTransactionInfo = true; protected $_allowCurrencyCode = ['USD']; + /** + * @var Mage_Paygate_Model_Authorizenet_Cards + */ + protected $_cardsStorage; + /** * Fields that should be replaced in debug with '***' * * @var array */ - protected $_debugReplacePrivateDataKeys = ['x_login', 'x_tran_key', - 'x_card_num', 'x_exp_date', - 'x_card_code', 'x_bank_aba_code', - 'x_bank_name', 'x_bank_acct_num', - 'x_bank_acct_type','x_bank_acct_name', - 'x_echeck_type']; + protected $_debugReplacePrivateDataKeys = [ + 'x_login', 'x_tran_key', + 'x_card_num', 'x_exp_date', + 'x_card_code', 'x_bank_aba_code', + 'x_bank_name', 'x_bank_acct_num', + 'x_bank_acct_type','x_bank_acct_name', + 'x_echeck_type' + ]; /** * Key for storing fraud transaction flag in additional information of payment model diff --git a/app/code/core/Mage/Paypal/Block/Express/Review.php b/app/code/core/Mage/Paypal/Block/Express/Review.php index b59423b34f1..00adcf5e02c 100644 --- a/app/code/core/Mage/Paypal/Block/Express/Review.php +++ b/app/code/core/Mage/Paypal/Block/Express/Review.php @@ -46,6 +46,11 @@ class Mage_Paypal_Block_Express_Review extends Mage_Core_Block_Template */ protected $_paypalActionPrefix = 'paypal'; + /** + * @var Mage_Sales_Model_Quote_Address + */ + protected $_address; + /** * Quote object setter * diff --git a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php b/app/code/core/Mage/Paypal/Controller/Express/Abstract.php index 9ae5488c827..45e5aca0c91 100644 --- a/app/code/core/Mage/Paypal/Controller/Express/Abstract.php +++ b/app/code/core/Mage/Paypal/Controller/Express/Abstract.php @@ -42,6 +42,21 @@ abstract class Mage_Paypal_Controller_Express_Abstract extends Mage_Core_Control */ protected $_quote = false; + /** + * @var string + */ + protected $_checkoutType; + + /** + * @var string + */ + protected $_configMethod; + + /** + * @var string + */ + protected $_configType; + /** * Instantiate config */ diff --git a/app/code/core/Mage/Paypal/Model/Config.php b/app/code/core/Mage/Paypal/Model/Config.php index 658b4012b17..2b2262679d2 100644 --- a/app/code/core/Mage/Paypal/Model/Config.php +++ b/app/code/core/Mage/Paypal/Model/Config.php @@ -599,6 +599,33 @@ class Mage_Paypal_Model_Config 'zh_XC', ]; + public $allow_ba_signup; + public $api_cert; + public $api_password; + public $api_signature; + public $api_username; + public $apiAuthentication; + public $apiPassword; + public $apiSignature; + public $apiUsername; + public $business_account; + public $businessAccount; + public $buttonFlavor; + public $buttonType; + public $cctypes; + public $debug; + public $lineItemsEnabled; + public $lineItemsSummary; + public $paymentAction; + public $paymentMarkSize; + public $requireBillingAddress; + public $sandboxFlag; + public $solutionType; + public $transferShippingOptions; + public $verifyPeer; + public $visible_on_cart; + public $visible_on_product; + /** * Set method and store id, if specified * diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php index 577832a9886..4dc76290325 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php @@ -192,6 +192,11 @@ abstract class Mage_Sales_Model_Quote_Item_Abstract extends Mage_Core_Model_Abst */ protected $_messages = []; + /** + * @var array + */ + protected $_optionsByCode; + /** * Retrieve Quote instance * diff --git a/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php b/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php index ea4216fd77f..1cc0536a2ee 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php @@ -56,6 +56,11 @@ class Mage_Sales_Model_Resource_Sale_Collection extends Varien_Data_Collection_D */ protected $_orderStateCondition = null; + /** + * @var array + */ + protected $_orderStateValue; + /** * Set sales order entity and establish read connection * @@ -98,8 +103,8 @@ public function addStoreFilter($storeIds) */ public function setOrderStateFilter($state, $exclude = false) { - $this->_orderStateCondition = ($exclude) ? 'NOT IN' : 'IN'; - $this->_orderStateValue = (!is_array($state)) ? [$state] : $state; + $this->_orderStateCondition = $exclude ? 'NOT IN' : 'IN'; + $this->_orderStateValue = !is_array($state) ? [$state] : $state; return $this; } diff --git a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php index feab5b4fe12..fa222389f2b 100644 --- a/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php +++ b/app/code/core/Mage/Shipping/Model/Carrier/Abstract.php @@ -93,6 +93,20 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object */ protected $_debugReplacePrivateDataKeys = []; + /** + * Raw rate request data + * + * @var Varien_Object|null + */ + protected $_rawRequest; + + /** + * Rate result data + * + * @var Mage_Shipping_Model_Rate_Result|null + */ + protected $_result; + /** * Retrieve information from carrier configuration *