diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c16b8b334ec..be7daaf06a4 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,9 +1,7 @@ setRiskyAllowed(true) @@ -35,5 +33,5 @@ ]) ->name('*.php') ->ignoreDotFiles(true) - ->ignoreVCS(true) + ->ignoreVCS(true), ); diff --git a/.phpstan.dist.baseline.neon b/.phpstan.dist.baseline.neon index f9f7f2e4abb..27bc035eef6 100644 --- a/.phpstan.dist.baseline.neon +++ b/.phpstan.dist.baseline.neon @@ -210,12 +210,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/Block/Report/Refresh/Statistics/Grid.php - - - message: '#^Parameter \#2 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:prepareForAbandonedReport\(\) expects string\|null, array\\|string\> given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Adminhtml/Block/Report/Shopcart/Abandoned/Grid.php - - message: '#^Parameter \#1 \$statusCode of method Mage_Tag_Model_Resource_Popular_Collection\:\:addStatusFilter\(\) expects string, int given\.$#' identifier: argument.type @@ -1254,12 +1248,6 @@ parameters: count: 1 path: app/code/core/Mage/Api2/Model/Route/ApiType.php - - - message: '#^Method Mage_Api2_Model_Server\:\:_setAuthUser\(\) has Exception in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: app/code/core/Mage/Api2/Model/Server.php - - message: '#^Call to an undefined method Varien_Object\:\:encrypt\(\)\.$#' identifier: method.notFound @@ -1626,12 +1614,6 @@ parameters: count: 1 path: app/code/core/Mage/Catalog/Helper/Product/Compare.php - - - message: '#^Parameter \#3 \$subject of function str_replace expects array\\|string, float given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php - - message: '#^Call to an undefined method Mage_Core_Model_Resource_Db_Collection_Abstract\:\:setStoreId\(\)\.$#' identifier: method.notFound @@ -2670,6 +2652,18 @@ parameters: count: 1 path: app/code/core/Mage/Centinel/Helper/Data.php + - + message: '#^Method Mage_Centinel_Model_Api\:\:callLookup\(\) should return \$this\(Mage_Centinel_Model_Api\) but returns Varien_Object\.$#' + identifier: return.type + count: 1 + path: app/code/core/Mage/Centinel/Model/Api.php + + - + message: '#^Property Mage_Centinel_Model_Api\:\:\$_clientInstance \(Mage_Centinel_Model_Api_Client\) in empty\(\) is not falsy\.$#' + identifier: empty.property + count: 1 + path: app/code/core/Mage/Centinel/Model/Api.php + - message: '#^Cannot call method setItem\(\) on array\.$#' identifier: method.nonObject @@ -3252,6 +3246,18 @@ parameters: count: 1 path: app/code/core/Mage/Core/Model/Locale.php + - + message: '#^Method Mage_Core_Model_Mysql4_Design_Theme_Collection\:\:setData\(\) invoked with 2 parameters, 1 required\.$#' + identifier: arguments.count + count: 1 + path: app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php + + - + message: '#^Parameter \#1 \$value of method Mage_Core_Model_Mysql4_Design_Theme_Collection\:\:setData\(\) expects array, string given\.$#' + identifier: argument.type + count: 1 + path: app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php + - message: '#^Call to an undefined method Mage_Core_Model_Resource_Type_Abstract\:\:getConnection\(\)\.$#' identifier: method.notFound @@ -4422,12 +4428,6 @@ parameters: count: 1 path: app/code/core/Mage/GiftMessage/controllers/IndexController.php - - - message: '#^Method Mage_GoogleAnalytics_Block_Ga\:\:_getOrdersTrackingCode\(\) has Mage_Core_Model_Store_Exception in PHPDoc @throws tag but it''s not thrown\.$#' - identifier: throws.unusedType - count: 1 - path: app/code/core/Mage/GoogleAnalytics/Block/Ga.php - - message: '#^Return type \(void\) of method Mage_GoogleCheckout_Model_Payment\:\:authorize\(\) should be compatible with return type \(\$this\(Mage_Payment_Model_Method_Abstract\)\) of method Mage_Payment_Model_Method_Abstract\:\:authorize\(\)$#' identifier: method.childReturnType @@ -5004,6 +5004,12 @@ parameters: count: 1 path: app/code/core/Mage/Paypal/Model/Pro.php + - + message: '#^Variable \$line in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 1 + path: app/code/core/Mage/Paypal/Model/Report/Settlement.php + - message: '#^Method Varien_Data_Collection\:\:toOptionArray\(\) invoked with 1 parameter, 0 required\.$#' identifier: arguments.count @@ -5190,18 +5196,6 @@ parameters: count: 1 path: app/code/core/Mage/Reports/Model/Resource/Product/Sold/Collection.php - - - message: '#^Parameter \#1 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:addCustomerData\(\) expects array\|null, string\|null given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php - - - - message: '#^Parameter \#2 \$filter of method Mage_Reports_Model_Resource_Quote_Collection\:\:addSubtotal\(\) expects array\|null, string\|null given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php - - message: '#^Parameter \#3 \$cols of method Zend_Db_Select\:\:joinInner\(\) expects array\|string, null given\.$#' identifier: argument.type @@ -5682,12 +5676,6 @@ parameters: count: 1 path: app/code/core/Mage/Sales/Model/Quote.php - - - message: '#^Parameter \#2 \$array of function implode expects array\, list\ given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Sales/Model/Quote.php - - message: '#^Property Mage_Sales_Model_Quote\:\:\$_addresses \(Mage_Sales_Model_Resource_Order_Address_Collection\|null\) does not accept Mage_Sales_Model_Resource_Quote_Address_Collection\.$#' identifier: assign.propertyType @@ -5784,18 +5772,6 @@ parameters: count: 3 path: app/code/core/Mage/Sales/Model/Recurring/Profile.php - - - message: '#^Parameter \#2 \$attribute of method Mage_Sales_Model_Resource_Order_Abstract\:\:_afterSaveAttribute\(\) expects string, array\ given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php - - - - message: '#^Parameter \#2 \$attribute of method Mage_Sales_Model_Resource_Order_Abstract\:\:_beforeSaveAttribute\(\) expects string, array\ given\.$#' - identifier: argument.type - count: 1 - path: app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php - - message: '#^Cannot call method updateOnRelatedRecordChanged\(\) on Mage_Core_Model_Resource_Db_Collection_Abstract\|false\.$#' identifier: method.nonObject @@ -8364,6 +8340,30 @@ parameters: count: 1 path: lib/Varien/Db/Statement/Pdo/Mysql.php + - + message: '#^Binary operation "\.\=" between array and non\-falsy\-string results in an error\.$#' + identifier: assignOp.invalid + count: 1 + path: lib/Varien/File/Object.php + + - + message: '#^Method Varien_Directory_Collection\:\:lastDir\(\) invoked with 1 parameter, 0 required\.$#' + identifier: arguments.count + count: 1 + path: lib/Varien/File/Object.php + + - + message: '#^Parameter &\$files by\-ref type of method Varien_File_Object\:\:getFilesName\(\) expects array, array\|null given\.$#' + identifier: parameterByRef.type + count: 1 + path: lib/Varien/File/Object.php + + - + message: '#^Static call to instance method Varien_Directory_Collection\:\:lastDir\(\)\.$#' + identifier: method.staticCall + count: 1 + path: lib/Varien/File/Object.php + - message: '#^Right side of && is always false\.$#' identifier: booleanAnd.rightAlwaysFalse diff --git a/.phpstan.dist.neon b/.phpstan.dist.neon index f2b2b182dbb..a839a670275 100644 --- a/.phpstan.dist.neon +++ b/.phpstan.dist.neon @@ -17,59 +17,32 @@ parameters: - index.php - install.php - app/Mage.php - - app/code/core/Mage + - app/code/core/ - app/design/ - - errors - - lib/Mage - - lib/Magento - - lib/Varien - - shell - - tests/unit + - errors/ + - lib/ + - shell/ + - tests/unit/ excludePaths: - #incompatible interfaces - - app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php - - app/code/core/Mage/Admin/Model/Acl/Assert/Time.php - - app/code/core/Mage/Api/Model/Acl/Assert/Ip.php - - app/code/core/Mage/Api/Model/Acl/Assert/Time.php - - app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php - - lib/Varien/Directory/Collection.php - - lib/Varien/Directory/Factory.php - - lib/Varien/File/Object.php - - # deprecated _getHelper() - - app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php - - app/code/core/Mage/Adminhtml/controllers/Rss/OrderController.php - - app/code/core/Mage/Adminhtml/controllers/Rss/CatalogController.php - - # contains 1 abstract method and must therefore be declared abstract or implement the remaining methods - - app/code/core/Mage/Dataflow/Model/Session/Adapter/Http.php - - app/code/core/Mage/Dataflow/Model/Convert/Iterator/Http.php - - app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php - - lib/Varien/Convert/Validator/Column.php - - # Cannot declare class Varien_Date, because the name is already in use - - app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php + # custom commands + - lib/_n98-magerun/ (?) - # Cannot declare class XMLParser, because the name is already in use - - app/code/core/Mage/Centinel/Model/Api.php - - app/code/core/Mage/Centinel/Model/Api/Client.php - - # Class phpseclib\Net\SSH2 not found. - - app/code/core/Mage/Paypal/Model/Report/Settlement.php - - lib/Varien/Io/Sftp.php + # libraries + - lib/3Dsecure/ + - lib/Unserialize/ - # Dataflow/Model/Convert/Iterator.php - - app/code/core/Mage/Dataflow/Model/Convert/Iterator.php + # others + - lib/Varien/Directory/Collection.php # Too much noise from "Variable $this might not be defined" - app/code/core/*/*/data/* - app/code/core/*/*/sql/* - # requires Mycrypt - - lib/Magento/Crypt.php - - lib/Varien/Crypt/Mcrypt.php + # Class Mage_Centinel_Model_Api_Client extends unknown class CentinelClient. + - app/code/core/Mage/Centinel/Model/Api/Client.php - # Instantiated class not found + # Instantiated class Varien_Image_Adapter_Gd not found. + # Instantiated class Varien_Image_Adapter_Imagemagic not found. - lib/Varien/Image/Adapter.php ignoreErrors: - diff --git a/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php b/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php deleted file mode 100644 index 924940aaf7b..00000000000 --- a/app/code/core/Mage/Admin/Model/Acl/Assert/Ip.php +++ /dev/null @@ -1,47 +0,0 @@ -_isCleanIP(Mage::helper('core/http')->getRemoteAddr()); - } - - /** - * @param string|false $ip - */ - protected function _isCleanIP($ip) - { - // ... - } -} diff --git a/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php b/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php deleted file mode 100644 index 602a03c76fa..00000000000 --- a/app/code/core/Mage/Admin/Model/Acl/Assert/Time.php +++ /dev/null @@ -1,47 +0,0 @@ -_isCleanTime(time()); - } - - /** - * @param int $time - */ - protected function _isCleanTime($time) - { - // ... - } -} diff --git a/app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php b/app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php index 1eda1a1df12..92fb709428b 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php @@ -52,16 +52,4 @@ protected function checkFeedEnable($code) return false; } } - - /** - * Retrieve helper instance - * - * @param string $name - * @return Mage_Core_Helper_Abstract - * @deprecated this method is incompatible with parent class. Use Mage::helper instead - */ - protected function _getHelper($name) - { - return Mage::helper($name); - } } diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php b/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php deleted file mode 100644 index bddee3907be..00000000000 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Ip.php +++ /dev/null @@ -1,47 +0,0 @@ -_isCleanIP(Mage::helper('core/http')->getRemoteAddr()); - } - - /** - * @param bool $ip - */ - protected function _isCleanIP($ip) - { - // ... - } -} diff --git a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php b/app/code/core/Mage/Api/Model/Acl/Assert/Time.php deleted file mode 100644 index 5c21198dfda..00000000000 --- a/app/code/core/Mage/Api/Model/Acl/Assert/Time.php +++ /dev/null @@ -1,47 +0,0 @@ -_isCleanTime(time()); - } - - /** - * @param bool $time - */ - protected function _isCleanTime($time) - { - // ... - } -} diff --git a/app/code/core/Mage/Api2/Model/Server.php b/app/code/core/Mage/Api2/Model/Server.php index 1897a52cb2f..18ae99274ff 100644 --- a/app/code/core/Mage/Api2/Model/Server.php +++ b/app/code/core/Mage/Api2/Model/Server.php @@ -140,7 +140,6 @@ protected function _authenticate(Mage_Api2_Model_Request $request) /** * Set auth user * - * @throws Exception * @return $this */ protected function _setAuthUser(Mage_Api2_Model_Auth_User_Abstract $authUser) diff --git a/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php b/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php index 008106e59ee..d5206deaf7a 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Type/Composite.php @@ -31,7 +31,7 @@ class Mage_Catalog_Helper_Product_Type_Composite extends Mage_Core_Helper_Abstra * @param float $price * @param bool $isPercent * @param null|int $storeId - * @return mixed + * @return string */ public function preparePrice($product, $price, $isPercent = false, $storeId = null) { @@ -49,7 +49,7 @@ public function preparePrice($product, $price, $isPercent = false, $storeId = nu * @param float $price * @param bool $isPercent * @param null|int $storeId - * @return mixed + * @return string */ public function prepareOldPrice($product, $price, $isPercent = false, $storeId = null) { @@ -68,7 +68,7 @@ public function prepareOldPrice($product, $price, $isPercent = false, $storeId = */ public function registerJsPrice($price) { - return str_replace(',', '.', $price); + return str_replace(',', '.', (string) $price); } /** diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php index 76bedbc44da..e4378b1dc16 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php @@ -70,7 +70,7 @@ public function validateUserValue($values) 'date_internal' => $value['date_internal'] ?? '', ], ); - } elseif (!$isValid && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { + } elseif ($option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { $this->setIsValid(false); if (!$dateValid) { Mage::throwException(Mage::helper('catalog')->__('Please specify date required option %s.', $option->getTitle())); @@ -91,12 +91,12 @@ public function validateUserValue($values) * Prepare option value for cart * * @throws Mage_Core_Exception - * @return mixed Prepared option value + * @return string|null Prepared option value */ public function prepareForCart() { if ($this->getIsValid() && $this->getUserValue() !== null) { - $option = $this->getOption(); + $this->getOption(); $value = $this->getUserValue(); if (isset($value['date_internal']) && $value['date_internal'] != '') { @@ -114,7 +114,7 @@ public function prepareForCart() $timestamp += mktime(0, 0, 0, $value['month'], $value['day'], $value['year']); } } else { - $timestamp += mktime(0, 0, 0, date('m'), date('d'), date('Y')); + $timestamp += mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('Y')); } if ($this->_timeExists()) { diff --git a/app/code/core/Mage/Centinel/Model/Api/Client.php b/app/code/core/Mage/Centinel/Model/Api/Client.php index 4aaec5b48fe..bd567817da0 100644 --- a/app/code/core/Mage/Centinel/Model/Api/Client.php +++ b/app/code/core/Mage/Centinel/Model/Api/Client.php @@ -38,11 +38,11 @@ public function sendHttp($url, $connectTimeout, $timeout) $ch = curl_init($url); // set URL and other appropriate options - curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); // Execute the request. diff --git a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php index 51a9261a295..9f211109748 100644 --- a/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php +++ b/app/code/core/Mage/Core/Model/Mysql4/Design/Theme/Collection.php @@ -26,7 +26,7 @@ class Mage_Core_Model_Mysql4_Design_Theme_Collection extends Varien_Directory_Co /** * @return $this */ - public function load() + public function load($printQuery = false, $logQuery = false) { $packages = $this->getData('themes'); if (is_null($packages)) { diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php deleted file mode 100644 index 1e7135e00b8..00000000000 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php +++ /dev/null @@ -1,120 +0,0 @@ -loadTotalBySessionId($sessionId); - - $callbacks = []; - if ($mapperCb = $this->_parseCallback($this->getVar('mapper'), 'mapRow')) { - $callbacks[] = $mapperCb; - } - if ($adapterCb = $this->_parseCallback($this->getVar('adapter'), 'saveRow')) { - $callbacks[] = $adapterCb; - } - $callbacks[] = [$this, 'updateProgress']; - - echo $this->_getProgressBarHtml($sessionId, $total['cnt']); - - Mage::getModel('core/resource_iterator') - ->walk($import->select($sessionId), $callbacks); - } - - protected function _getProgressBarHtml($sessionId, $totalRows) - { - return ' -
  • -
    -
    -
    -
    - ' . $this->__('Total records: %s', '' . $totalRows . '') . ', - ' . $this->__('Processed records: %s', '0') . ', - ' . $this->__('ETA: %s', 'N/A') . ', - ' . $this->__('Memory Used: %s', '' - . memory_get_usage(true) . '') . ' -
    -
    -
  • -'; - } - - public function updateProgress($args) - { - $memory = !empty($args['memory']) ? $args['memory'] : ''; - echo ''; - echo '
  • ' . $memory . '
  • '; - - return []; - } - - protected function _parseCallback($callback, $defaultMethod = null) - { - if (!preg_match('#^([a-z0-9_/]+)(::([a-z0-9_]+))?$#i', $callback, $match)) { - return false; - } - if (!($model = Mage::getModel($match[1]))) { - return false; - } - if (!($method = $match[3] ? $match[3] : $defaultMethod)) { - return false; - } - return [$model, $method]; - } -} diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php deleted file mode 100644 index 47f1326d6a2..00000000000 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/File/Csv.php +++ /dev/null @@ -1,21 +0,0 @@ -'; - echo 'File to upload: '; - echo ''; - exit; - } - if (!empty($_FILES['io_file']['tmp_name'])) { - $uploader = Mage::getModel('core/file_uploader', 'io_file'); - $uploader->setAllowedExtensions(['csv','xml']); - $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; - $uploader->save($path); - if ($uploadFile = $uploader->getUploadedFileName()) { - $fp = fopen($uploadFile, 'rb'); - while ($row = fgetcsv($fp)) { - // check csv - } - fclose($fp); - } - } - return $this; - } -} diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php deleted file mode 100644 index be14e519ad2..00000000000 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator/Interface.php +++ /dev/null @@ -1,26 +0,0 @@ -'; - echo 'File to upload: '; - echo ''; - exit; - } - - if (!empty($_FILES['io_file']['tmp_name'])) { - $uploader = Mage::getModel('core/file_uploader', 'io_file'); - $uploader->setAllowedExtensions(['csv', 'xml']); - $path = Mage::app()->getConfig()->getTempVarDir() . '/import/'; - $uploader->save($path); - if ($uploadFile = $uploader->getUploadedFileName()) { - $session = Mage::getModel('dataflow/session'); - $session->setCreatedDate(date(Varien_Date::DATETIME_PHP_FORMAT)); - $session->setDirection('import'); - $session->setUserId(Mage::getSingleton('admin/session')->getUser()->getId()); - $session->save(); - $sessionId = $session->getId(); - $newFilename = 'import_' . $sessionId . '_' . $uploadFile; - rename($path . $uploadFile, $path . $newFilename); - $session->setFile($newFilename); - $session->save(); - $this->setData(file_get_contents($path . $newFilename)); - Mage::register('current_dataflow_session_id', $sessionId); - } - } - return $this; - } -} diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index 336fee12a96..6fb29839c3d 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -112,7 +112,6 @@ protected function _getPageTrackingCodeAnalytics($accountId) * Render information about specified orders and their items * * @return string - * @throws Mage_Core_Model_Store_Exception * @deprecated */ protected function _getOrdersTrackingCode() diff --git a/app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php b/app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php index d6c7631f949..f893a0d128c 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/core/Mage/Reports/Model/Resource/Quote/Collection.php @@ -65,7 +65,7 @@ protected function _construct() * Prepare for abandoned report * * @param array $storeIds - * @param string $filter + * @param array $filter * @return $this */ public function prepareForAbandonedReport($storeIds, $filter = null) diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index 6e31796a00c..2118510040b 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -1084,6 +1084,7 @@ public function addProductAdvanced(Mage_Catalog_Model_Product $product, $request // collect errors instead of throwing first one if ($item->getHasError()) { + /** @var string $message */ $message = $item->getMessage(); if (!in_array($message, $errors)) { // filter duplicate messages $errors[] = $message; diff --git a/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php b/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php index f493933134a..b0f233a29c6 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php @@ -267,7 +267,7 @@ public function getGridTable() /** * Before save object attribute * - * @param string $attribute + * @param array|string $attribute * @return $this */ protected function _beforeSaveAttribute(Mage_Core_Model_Abstract $object, $attribute) @@ -285,7 +285,7 @@ protected function _beforeSaveAttribute(Mage_Core_Model_Abstract $object, $attri /** * After save object attribute * - * @param string $attribute + * @param array|string $attribute * @return $this */ protected function _afterSaveAttribute(Mage_Core_Model_Abstract $object, $attribute) diff --git a/lib/Varien/Convert/Validator/Column.php b/lib/Varien/Convert/Validator/Column.php deleted file mode 100644 index 535442a8319..00000000000 --- a/lib/Varien/Convert/Validator/Column.php +++ /dev/null @@ -1,23 +0,0 @@ -_path = $path; $this->_filename = basename($path); } + /** * add file name to array * * @param array &$files - array of files - * @return none */ public function getFilesName(&$files) { $this->getFileName($files); } + /** * add file name to array * * @param array &$files - array of files - * @return none + * @return string|void */ public function getFileName(&$files = null) { @@ -69,11 +69,11 @@ public function getFileName(&$files = null) $files[] = $this->_filename; } } + /** * add file path to array * * @param array &$paths - array of paths - * @return none */ public function getFilesPaths(&$paths) { @@ -81,11 +81,12 @@ public function getFilesPaths(&$paths) $paths[] = (string) $this->_path; } } + /** * add file path to array * - * @param array &$paths - array of paths - * @return none + * @param array &$path - array of paths + * @return string|void */ public function getFilePath(&$path = null) { @@ -96,11 +97,11 @@ public function getFilePath(&$path = null) $paths[] = $this->_path; } } + /** * use filter * * @param bool $useFilter - use or not filter - * @return none */ public function useFilter($useFilter) { @@ -111,11 +112,11 @@ public function useFilter($useFilter) $this->filtered = false; } } + /** * add file object to array * * @param array &$objs - array of gile objects - * @return none */ public function getFilesObj(&$objs) { @@ -123,11 +124,12 @@ public function getFilesObj(&$objs) $objs[] = $this; } } + /** * nothing * * @param array &$dirs - array of dirs - * @return none + * @return string */ public function getDirsName(&$dirs) { @@ -136,33 +138,33 @@ public function getDirsName(&$dirs) /** * nothing * - * @param array &$dirs - array of dirs - * @return none + * @return string */ public function getDirName() { return Varien_Directory_Collection::lastDir($this->_path); } + /** * set file filter * * @param array $filter - array of filter - * @return none */ public function setFilesFilter($filter) { $this->addFilter($filter); } + /** * set file filter * * @param array $filter - array of filter - * @return none */ public function addFilter($filter) { $this->_filter = $filter; } + /** * get extension of file * @@ -172,6 +174,7 @@ public function getExtension() { return self::getExt($this->_filename); } + /** * get extension of file * @@ -187,6 +190,7 @@ public static function getExt($fileName) return ''; } } + /** * get name of file * @@ -196,10 +200,9 @@ public function getName() { return basename($this->_filename, '.' . $this->getExtension()); } + /** * render filters - * - * @return none */ public function renderFilter() { @@ -247,11 +250,11 @@ public function renderFilter() } } } + /** * add to array file name * * @param array &$arr -export array - * @return none */ public function toArray(&$arr) { @@ -259,6 +262,7 @@ public function toArray(&$arr) $arr['files_in_dirs'][] = $this->_filename; } } + /** * add to xml file name * @@ -266,7 +270,6 @@ public function toArray(&$arr) * @param int $recursionLevel - level of recursion * @param bool $addOpenTag - nothing * @param string $rootName - nothing - * @return none */ public function toXml(&$xml, $recursionLevel = 0, $addOpenTag = true, $rootName = 'Struct') { diff --git a/lib/Varien/Io/Sftp.php b/lib/Varien/Io/Sftp.php index d6f4b0363fb..72828c3abe4 100644 --- a/lib/Varien/Io/Sftp.php +++ b/lib/Varien/Io/Sftp.php @@ -14,6 +14,8 @@ * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use phpseclib3\Net\SFTP; + /** * Sftp client interface * @@ -27,19 +29,15 @@ class Varien_Io_Sftp extends Varien_Io_Abstract implements Varien_Io_Interface public const SSH2_PORT = 22; /** - * @var \phpseclib3\Net\SFTP $_connection + * @var SFTP $_connection */ protected $_connection = null; /** * Open a SFTP connection to a remote site. * - * @param array $args Connection arguments - * @param string $args[host] Remote hostname - * @param string $args[username] Remote username - * @param string $args[password] Connection password - * @param int $args[timeout] Connection timeout [=10] - * + * @param array{host?: mixed, username?: mixed, password?: mixed, timeout?: int} $args Connection arguments + * @throws Exception */ public function open(array $args = []) { @@ -52,19 +50,19 @@ public function open(array $args = []) $host = $args['host']; $port = self::SSH2_PORT; } - $this->_connection = new \phpseclib3\Net\SFTP($host, $port, $args['timeout']); + $this->_connection = new SFTP($host, $port, $args['timeout']); if (!$this->_connection->login($args['username'], $args['password'])) { throw new Exception(sprintf(__('Unable to open SFTP connection as %s@%s', $args['username'], $args['host']))); } + return true; } /** * Close a connection - * */ public function close() { - return $this->_connection->disconnect(); + $this->_connection->disconnect(); } /** @@ -224,6 +222,6 @@ public function rawls() */ public function writeFile($filename, $src) { - return $this->_connection->put($filename, $src, \phpseclib3\Net\SFTP::SOURCE_LOCAL_FILE); + return $this->_connection->put($filename, $src, SFTP::SOURCE_LOCAL_FILE); } }