From a5bc562222d973b692c1e1e5ba7e093ffd1c01c1 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Mon, 27 Oct 2025 06:07:14 +0100 Subject: [PATCH 1/3] rector: `FirstClassCallableRector` - https://getrector.com/rule-detail/first-class-callable-rector --- .rector.php | 1 - .../core/Mage/Adminhtml/Block/Cache/Grid.php | 2 +- .../Block/Sales/Order/Status/Grid.php | 4 +-- .../Adminhtml/Block/Sales/Order/View/Info.php | 2 +- .../Block/Sales/Order/View/Tab/History.php | 4 +-- .../core/Mage/Adminhtml/Controller/Action.php | 2 +- app/code/core/Mage/Adminhtml/Helper/Data.php | 2 +- .../Model/System/Config/Backend/Color.php | 2 +- .../Model/System/Config/Source/Allregion.php | 2 +- .../Sales/Order/ShipmentController.php | 4 +-- app/code/core/Mage/Api/Model/Roles.php | 3 +- .../Api/Model/Server/Handler/Abstract.php | 2 +- .../Mage/Api2/Block/Adminhtml/Roles/Grid.php | 2 +- app/code/core/Mage/Api2/Model/Config.php | 2 +- app/code/core/Mage/Api2/Model/Request.php | 2 +- .../core/Mage/Bundle/Model/Product/Type.php | 12 +++---- .../Mage/Catalog/Model/Layer/Filter/Price.php | 6 ++-- app/code/core/Mage/Catalog/Model/Product.php | 2 +- .../Model/Product/Type/Configurable.php | 2 +- .../Catalog/Model/Product/Type/Grouped.php | 2 +- .../Model/Resource/Product/Collection.php | 2 +- .../Mage/CatalogInventory/Model/Observer.php | 2 +- app/code/core/Mage/CatalogRule/Model/Rule.php | 2 +- .../core/Mage/CatalogSearch/Helper/Data.php | 2 +- .../Helper/Mediafallback.php | 2 +- .../Helper/Productimg.php | 4 +-- .../Core/Helper/EnvironmentConfigLoader.php | 2 +- app/code/core/Mage/Core/Model/Abstract.php | 2 +- app/code/core/Mage/Core/Model/Cache.php | 2 +- .../core/Mage/Core/Model/Design/Package.php | 2 +- .../core/Mage/Core/Model/Email/Template.php | 4 +-- .../Core/Model/Email/Template/Abstract.php | 2 +- .../Mage/Core/Model/Email/Template/Filter.php | 2 +- .../core/Mage/Core/Model/Resource/Session.php | 12 +++---- .../core/Mage/Core/Model/Resource/Setup.php | 4 +-- app/code/core/Mage/Core/Model/Url.php | 2 +- .../Mage/Dataflow/Model/Convert/Iterator.php | 2 +- .../Mage/Downloadable/Model/Product/Type.php | 2 +- .../Mage/Eav/Model/Attribute/Data/File.php | 2 +- .../core/Mage/Eav/Model/Entity/Abstract.php | 2 +- .../Block/Adminhtml/Export/Filter.php | 2 +- .../Model/Import/Entity/Abstract.php | 4 +-- .../Index/Block/Adminhtml/Process/Grid.php | 6 ++-- .../core/Mage/Newsletter/Model/Template.php | 4 +-- .../Adminhtml/Oauth/AuthorizedTokens/Grid.php | 4 +-- app/code/core/Mage/Paygate/Helper/Data.php | 2 +- .../System/Config/Fieldset/Deprecated.php | 2 +- .../core/Mage/Paypal/Model/Api/Abstract.php | 8 ++--- .../Mage/Paypal/Model/Express/Checkout.php | 2 +- app/code/core/Mage/Paypal/Model/Info.php | 4 +-- .../core/Mage/Paypal/Model/Payflowlink.php | 4 +-- .../Mage/Rating/Model/Resource/Rating.php | 2 +- app/code/core/Mage/Rss/Block/Catalog/New.php | 2 +- .../Mage/Rss/Block/Catalog/NotifyStock.php | 2 +- .../core/Mage/Rss/Block/Catalog/Review.php | 2 +- .../core/Mage/Rss/Block/Catalog/Special.php | 2 +- app/code/core/Mage/Rss/Block/Catalog/Tag.php | 2 +- app/code/core/Mage/Rss/Block/Order/New.php | 2 +- .../Rule/Model/Condition/Product/Abstract.php | 4 +-- .../core/Mage/Sales/Block/Order/Totals.php | 2 +- .../core/Mage/Sales/Model/Resource/Setup.php | 2 +- .../core/Mage/Sales/Model/Service/Quote.php | 4 +-- .../core/Mage/Uploader/Block/Abstract.php | 2 +- app/code/core/Mage/Uploader/Helper/File.php | 4 +-- cron.php | 2 +- errors/processor.php | 2 +- lib/Mage/HTTP/Client/Curl.php | 4 +-- lib/Mage/HTTP/Client/Socket.php | 4 +-- lib/Varien/Data/Collection/Filesystem.php | 34 +++++++++---------- lib/Varien/Db/Adapter/Pdo/Mysql.php | 11 +++--- shell/indexer.php | 2 +- 71 files changed, 120 insertions(+), 129 deletions(-) diff --git a/.rector.php b/.rector.php index fe2dd2477cf..09506ed2bd6 100644 --- a/.rector.php +++ b/.rector.php @@ -117,7 +117,6 @@ Php80\Class_\ClassPropertyAssignToConstructorPromotionRector::class, # todo: wait for php80 Php80\Class_\StringableForToStringRector::class, # todo: wait for php80 Php80\ClassMethod\AddParamBasedOnParentClassMethodRector::class, # todo: TMP - Php81\Array_\FirstClassCallableRector::class, # todo: TMP Php81\FuncCall\NullToStrictStringFuncCallArgRector::class, # todo: check later Strict\Empty_\DisallowedEmptyRuleFixerRector::class, # todo: TMP TypeDeclaration\BooleanAnd\BinaryOpNullableToInstanceofRector::class, # todo: TMP diff --git a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php index 72190ea9094..9e6ed06fe65 100644 --- a/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Cache/Grid.php @@ -86,7 +86,7 @@ protected function _prepareColumns() 'index' => 'status', 'type' => 'options', 'options' => [0 => $this->__('Disabled'), 1 => $this->__('Enabled')], - 'frame_callback' => [$this, 'decorateStatus'], + 'frame_callback' => $this->decorateStatus(...), ]); return parent::_prepareColumns(); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php index 1684bbe1039..5c4103f2a4d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Status/Grid.php @@ -62,7 +62,7 @@ protected function _prepareColumns() 'type' => 'text', 'index' => 'state', 'width' => '250px', - 'frame_callback' => [$this, 'decorateState'], + 'frame_callback' => $this->decorateState(...), ]); $this->addColumn('unassign', [ @@ -70,7 +70,7 @@ protected function _prepareColumns() 'index' => 'unassign', 'width' => '100px', 'type' => 'text', - 'frame_callback' => [$this, 'decorateAction'], + 'frame_callback' => $this->decorateAction(...), 'sortable' => false, 'filter' => false, ]); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php index 89c25d0d327..274a14cd38b 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Info.php @@ -47,7 +47,7 @@ public function getOrderStoreName() $store->getGroup()->getName(), $store->getName(), ]; - return implode('
', array_map([$this, 'escapeHtml'], $name)); + return implode('
', array_map($this->escapeHtml(...), $name)); } return null; diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php index cda64734e36..4af07e46062 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php @@ -109,7 +109,7 @@ public function getFullHistory() ); } - usort($history, [self::class, '_sortHistoryByTimestamp']); + usort($history, $this->_sortHistoryByTimestamp(...)); return $history; } @@ -284,7 +284,7 @@ public function isCustomerNotificationNotApplicable($historyItem) * @return int */ // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError - private static function _sortHistoryByTimestamp($a, $b) + private function _sortHistoryByTimestamp($a, $b) { $createdAtA = $a['created_at']; $createdAtB = $b['created_at']; diff --git a/app/code/core/Mage/Adminhtml/Controller/Action.php b/app/code/core/Mage/Adminhtml/Controller/Action.php index 375e1cc72ef..2b569805c2b 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Action.php +++ b/app/code/core/Mage/Adminhtml/Controller/Action.php @@ -429,7 +429,7 @@ protected function _checkIsForcedFormKeyAction() { return in_array( strtolower($this->getRequest()->getActionName()), - array_map('strtolower', $this->_forcedFormKeyActions), + array_map(strtolower(...), $this->_forcedFormKeyActions), ); } diff --git a/app/code/core/Mage/Adminhtml/Helper/Data.php b/app/code/core/Mage/Adminhtml/Helper/Data.php index a3f6f3d7ecf..86531d11fcc 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Data.php +++ b/app/code/core/Mage/Adminhtml/Helper/Data.php @@ -122,7 +122,7 @@ public function prepareFilterString($filterString) $data = []; $filterString = base64_decode($filterString); parse_str($filterString, $data); - array_walk_recursive($data, [$this, 'decodeFilter']); + array_walk_recursive($data, $this->decodeFilter(...)); return $data; } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Color.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Color.php index 1f161839bbf..3c5ba9b9b47 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Color.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Color.php @@ -25,7 +25,7 @@ protected function _beforeSave() $validate = []; if (isset($config->validate)) { - $validate = array_map('trim', explode(' ', $config->validate)); + $validate = array_map(trim(...), explode(' ', $config->validate)); } if (!(string) $this->getValue() && !in_array('required-entry', $validate)) { diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php index 763f48438e1..8f3e0e1f708 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Source/Allregion.php @@ -32,7 +32,7 @@ public function toOptionArray($isMultiselect = false) $countryRegions[$region->getCountryId()][$region->getId()] = $region->getDefaultName(); } - uksort($countryRegions, [$this, 'sortRegionCountries']); + uksort($countryRegions, $this->sortRegionCountries(...)); $this->_options = []; foreach ($countryRegions as $countryId => $regions) { diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php index 86e6b771eab..7fbb6b5975a 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php @@ -652,7 +652,7 @@ public function massPrintShippingLabelAction() switch ($request->getParam('massaction_prepare_key')) { case 'shipment_ids': $ids = $request->getParam('shipment_ids'); - array_filter($ids, '\intval'); + array_filter($ids, \intval(...)); if (!empty($ids)) { $shipments = Mage::getResourceModel('sales/order_shipment_collection') ->addFieldToFilter('entity_id', ['in' => $ids]); @@ -661,7 +661,7 @@ public function massPrintShippingLabelAction() break; case 'order_ids': $ids = $request->getParam('order_ids'); - array_filter($ids, '\intval'); + array_filter($ids, \intval(...)); if (!empty($ids)) { $shipments = Mage::getResourceModel('sales/order_shipment_collection') ->setOrderFilter(['in' => $ids]); diff --git a/app/code/core/Mage/Api/Model/Roles.php b/app/code/core/Mage/Api/Model/Roles.php index 0a704d0e9e1..40880aa305f 100644 --- a/app/code/core/Mage/Api/Model/Roles.php +++ b/app/code/core/Mage/Api/Model/Roles.php @@ -115,8 +115,7 @@ protected function _buildResourcesArray( $level = -1; } else { $resourceName = $parentName; - if ($resource->getName() != 'title' && $resource->getName() != 'sort_order' - && $resource->getName() != 'children' + if (!in_array($resource->getName(), ['title', 'sort_order', 'children']) ) { $resourceName = (is_null($parentName) ? '' : $parentName . '/') . $resource->getName(); diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 8c696421058..a3a9f1a0126 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -18,7 +18,7 @@ abstract class Mage_Api_Model_Server_Handler_Abstract public function __construct() { - set_error_handler([$this, 'handlePhpError'], E_ALL); + set_error_handler($this->handlePhpError(...), E_ALL); Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML, Mage_Core_Model_App_Area::PART_EVENTS); } diff --git a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php index d019fe4d5bc..e79fbd537b5 100644 --- a/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php +++ b/app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php @@ -59,7 +59,7 @@ protected function _prepareColumns() $this->addColumn('tole_user_type', [ 'header' => Mage::helper('oauth')->__('User Type'), 'sortable' => false, - 'frame_callback' => [$this, 'decorateUserType'], + 'frame_callback' => $this->decorateUserType(...), ]); $this->addColumn('created_at', [ diff --git a/app/code/core/Mage/Api2/Model/Config.php b/app/code/core/Mage/Api2/Model/Config.php index c67827279bb..c4e5baffba7 100644 --- a/app/code/core/Mage/Api2/Model/Config.php +++ b/app/code/core/Mage/Api2/Model/Config.php @@ -343,7 +343,7 @@ public function getVersions($node) } $versions = explode(',', (string) $element); - if (count(array_filter($versions, 'is_numeric')) != count($versions)) { + if (count(array_filter($versions, is_numeric(...))) != count($versions)) { throw new Exception(sprintf('Invalid resource "%s" versions in config.', htmlspecialchars($node))); } diff --git a/app/code/core/Mage/Api2/Model/Request.php b/app/code/core/Mage/Api2/Model/Request.php index 7940492ba86..2381133f1df 100644 --- a/app/code/core/Mage/Api2/Model/Request.php +++ b/app/code/core/Mage/Api2/Model/Request.php @@ -271,7 +271,7 @@ public function getRequestedAttributes() $include = explode(',', $include); } - return array_map('trim', $include); + return array_map(trim(...), $include); } /** diff --git a/app/code/core/Mage/Bundle/Model/Product/Type.php b/app/code/core/Mage/Bundle/Model/Product/Type.php index a6bf55cb432..ff1c4aded4f 100644 --- a/app/code/core/Mage/Bundle/Model/Product/Type.php +++ b/app/code/core/Mage/Bundle/Model/Product/Type.php @@ -531,7 +531,7 @@ protected function _prepareProduct(Varien_Object $buyRequest, $product, $process $options = $buyRequest->getBundleOption(); if (is_array($options)) { - $options = array_filter($options, '\intval'); + $options = array_filter($options, \intval(...)); $qtys = $buyRequest->getBundleOptionQty(); foreach ($options as $_optionId => $_selections) { if (empty($_selections)) { @@ -632,7 +632,7 @@ protected function _prepareProduct(Varien_Object $buyRequest, $product, $process $selectionIds = []; // Shuffle selection array by option position - usort($selections, [$this, 'shakeSelections']); + usort($selections, $this->shakeSelections(...)); foreach ($selections as $selection) { if ($selection->getSelectionCanChangeQty() && isset($qtys[$selection->getOptionId()])) { @@ -669,7 +669,7 @@ protected function _prepareProduct(Varien_Object $buyRequest, $product, $process } $result[] = $_result[0]->setParentProductId($product->getId()) - ->addCustomOption('bundle_option_ids', serialize(array_map('\intval', $optionIds))) + ->addCustomOption('bundle_option_ids', serialize(array_map(\intval(...), $optionIds))) ->addCustomOption('bundle_selection_attributes', serialize($attributes)); if ($isStrictProcessMode) { @@ -687,7 +687,7 @@ protected function _prepareProduct(Varien_Object $buyRequest, $product, $process $item->addCustomOption('bundle_identity', $uniqueKey); } - $product->addCustomOption('bundle_option_ids', serialize(array_map('\intval', $optionIds))); + $product->addCustomOption('bundle_option_ids', serialize(array_map(\intval(...), $optionIds))); $product->addCustomOption('bundle_selection_ids', serialize($selectionIds)); return $result; @@ -1008,8 +1008,8 @@ public function processBuyRequest($product, $buyRequest) $option = $buyRequest->getBundleOption(); $optionQty = $buyRequest->getBundleOptionQty(); - $option = (is_array($option)) ? array_filter($option, '\intval') : []; - $optionQty = (is_array($optionQty)) ? array_filter($optionQty, '\intval') : []; + $option = (is_array($option)) ? array_filter($option, \intval(...)) : []; + $optionQty = (is_array($optionQty)) ? array_filter($optionQty, \intval(...)) : []; return [ 'bundle_option' => $option, diff --git a/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php b/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php index 5fbef3c65e8..0e32179e052 100644 --- a/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php @@ -551,7 +551,7 @@ public function loadPrices($limit, $offset = null, $lowerPrice = null, $upperPri { $prices = $this->_getResource()->loadPrices($this, $limit, $offset, $lowerPrice, $upperPrice); if ($prices) { - $prices = array_map('\floatval', $prices); + $prices = array_map(\floatval(...), $prices); } return $prices; @@ -569,7 +569,7 @@ public function loadPreviousPrices($price, $index, $lowerPrice = null) { $prices = $this->_getResource()->loadPreviousPrices($this, $price, $index, $lowerPrice); if ($prices) { - $prices = array_map('\floatval', $prices); + $prices = array_map(\floatval(...), $prices); } return $prices; @@ -587,7 +587,7 @@ public function loadNextPrices($price, $rightIndex, $upperPrice = null) { $prices = $this->_getResource()->loadNextPrices($this, $price, $rightIndex, $upperPrice); if ($prices) { - $prices = array_map('\floatval', $prices); + $prices = array_map(\floatval(...), $prices); } return $prices; diff --git a/app/code/core/Mage/Catalog/Model/Product.php b/app/code/core/Mage/Catalog/Model/Product.php index 311ad856d06..50726d8d91a 100644 --- a/app/code/core/Mage/Catalog/Model/Product.php +++ b/app/code/core/Mage/Catalog/Model/Product.php @@ -594,7 +594,7 @@ public function setCategoryIds($ids) Mage::throwException(Mage::helper('catalog')->__('Invalid category IDs.')); } - $ids = array_filter(array_map('\intval', $ids)); + $ids = array_filter(array_map(\intval(...), $ids)); $this->setData('category_ids', $ids); return $this; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php index 356f61a0711..9050498523e 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php @@ -862,7 +862,7 @@ public function getSku($product = null) public function processBuyRequest($product, $buyRequest) { $superAttribute = $buyRequest->getSuperAttribute(); - $superAttribute = (is_array($superAttribute)) ? array_filter($superAttribute, '\intval') : []; + $superAttribute = (is_array($superAttribute)) ? array_filter($superAttribute, \intval(...)) : []; return ['super_attribute' => $superAttribute]; } diff --git a/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php b/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php index 49dd70acd8f..1e51370f9fb 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php +++ b/app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php @@ -375,7 +375,7 @@ public function getProductsToPurchaseByReqGroups($product = null) public function processBuyRequest($product, $buyRequest) { $superGroup = $buyRequest->getSuperGroup(); - $superGroup = (is_array($superGroup)) ? array_filter($superGroup, '\intval') : []; + $superGroup = (is_array($superGroup)) ? array_filter($superGroup, \intval(...)) : []; return ['super_group' => $superGroup]; } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php index 6d227627d4a..f25dfc8cf66 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php @@ -1805,7 +1805,7 @@ protected function _productLimitationPrice($joinLeft = false) // Set additional field filters foreach ($this->_priceDataFieldFilters as $filterData) { - $select->where(call_user_func_array('sprintf', $filterData)); + $select->where(call_user_func_array(sprintf(...), $filterData)); } } else { $fromPart['price_index']['joinCondition'] = $joinCond; diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index 1d0c3e61ef0..ed9244a9dd5 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -779,7 +779,7 @@ public function reindexQuoteInventory($observer) * This limits the number of stock re-indexing that takes place, * especially in stores where stock is not managed **/ - $productIds = array_map('\intval', $productIds); + $productIds = array_map(\intval(...), $productIds); $stockCollection = Mage::getModel('cataloginventory/stock_item')->getCollection() ->addFieldToFilter('product_id', ['in' => $productIds]) ->addFieldToFilter('manage_stock', ['eq' => 1]); diff --git a/app/code/core/Mage/CatalogRule/Model/Rule.php b/app/code/core/Mage/CatalogRule/Model/Rule.php index ef9755f2969..04b63a125e6 100644 --- a/app/code/core/Mage/CatalogRule/Model/Rule.php +++ b/app/code/core/Mage/CatalogRule/Model/Rule.php @@ -219,7 +219,7 @@ public function getMatchingProductIds() Mage::getSingleton('core/resource_iterator')->walk( $productCollection->getSelect(), - [[$this, 'callbackValidateProduct']], + [$this->callbackValidateProduct(...)], [ 'attributes' => $this->getCollectedAttributes(), 'product' => Mage::getModel('catalog/product'), diff --git a/app/code/core/Mage/CatalogSearch/Helper/Data.php b/app/code/core/Mage/CatalogSearch/Helper/Data.php index 8f67678e627..14c62100544 100644 --- a/app/code/core/Mage/CatalogSearch/Helper/Data.php +++ b/app/code/core/Mage/CatalogSearch/Helper/Data.php @@ -291,7 +291,7 @@ public function checkNotes($store = null) $wordsFull = $stringHelper->splitWords($this->getQueryText(), true); $wordsLike = $stringHelper->splitWords($this->getQueryText(), true, $this->getMaxQueryWords()); if (count($wordsFull) > count($wordsLike)) { - $wordsCut = array_map([$this, 'escapeHtml'], array_diff($wordsFull, $wordsLike)); + $wordsCut = array_map($this->escapeHtml(...), array_diff($wordsFull, $wordsLike)); $this->addNoteMessage( $this->__('Maximum words count is %1$s. In your search query was cut next part: %2$s.', $this->getMaxQueryWords(), implode(' ', $wordsCut)), ); diff --git a/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php b/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php index 7fae12527ae..b46e5f00bda 100644 --- a/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php +++ b/app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php @@ -76,7 +76,7 @@ public function attachProductChildrenAttributeMapping(array $parentProducts, $st // normalize to all lower case before we start using them $optionLabels = array_map(function ($value) { - return array_map('Mage_ConfigurableSwatches_Helper_Data::normalizeKey', $value); + return array_map(Mage_ConfigurableSwatches_Helper_Data::normalizeKey(...), $value); }, $optionLabels); foreach ($parentProducts as $parentProduct) { diff --git a/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php index bf390c47fb9..c189eaec00c 100644 --- a/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php +++ b/app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php @@ -95,7 +95,7 @@ public function indexProductImages($product, $preValues = null) $searchValues = []; if (!is_null($preValues) && is_array($preValues)) { // If a pre-defined list of valid values was passed - $preValues = array_map('Mage_ConfigurableSwatches_Helper_Data::normalizeKey', $preValues); + $preValues = array_map(Mage_ConfigurableSwatches_Helper_Data::normalizeKey(...), $preValues); foreach ($preValues as $value) { $searchValues[] = $value; } @@ -382,7 +382,7 @@ public function filterImageInGallery($product, $image) } if (!isset($this->_productImageFilters[$product->getId()])) { - $mapping = call_user_func_array('array_merge_recursive', array_values($product->getChildAttributeLabelMapping())); + $mapping = call_user_func_array(array_merge_recursive(...), array_values($product->getChildAttributeLabelMapping())); $filters = isset($mapping['labels']) ? array_unique($mapping['labels']) : []; $filters = array_merge($filters, array_map(function ($label) { return $label . Mage_ConfigurableSwatches_Helper_Productimg::SWATCH_LABEL_SUFFIX; diff --git a/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php b/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php index 4f4da0e088a..f74676fb5ae 100644 --- a/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php +++ b/app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php @@ -108,7 +108,7 @@ protected function getConfigKey(string $configKey): array static::ENV_KEY_SEPARATOR, $configKey, ), - 'trim', + trim(...), ); [$unused, $scope] = $configKeyParts; return [$configKeyParts, $scope]; diff --git a/app/code/core/Mage/Core/Model/Abstract.php b/app/code/core/Mage/Core/Model/Abstract.php index d1c40e9b3b8..6bb5452fc7b 100644 --- a/app/code/core/Mage/Core/Model/Abstract.php +++ b/app/code/core/Mage/Core/Model/Abstract.php @@ -381,7 +381,7 @@ public function save() $this->_afterSave(); } - $this->_getResource()->addCommitCallback([$this, 'afterCommitCallback']) + $this->_getResource()->addCommitCallback($this->afterCommitCallback(...)) ->commit(); $this->_hasDataChanges = false; } catch (Throwable $e) { diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php index f739458dce7..df602b90586 100644 --- a/app/code/core/Mage/Core/Model/Cache.php +++ b/app/code/core/Mage/Core/Model/Cache.php @@ -241,7 +241,7 @@ protected function getDbAdapterOptions(array $options = []) $this->_dbConnection = $options['connection']; } - $options['adapter_callback'] = [$this, 'getDbAdapter']; + $options['adapter_callback'] = $this->getDbAdapter(...); $options['data_table'] = Mage::getSingleton('core/resource')->getTableName('core/cache'); $options['tags_table'] = Mage::getSingleton('core/resource')->getTableName('core/cache_tag'); return $options; diff --git a/app/code/core/Mage/Core/Model/Design/Package.php b/app/code/core/Mage/Core/Model/Design/Package.php index 3e82c9d417c..1836819deb0 100644 --- a/app/code/core/Mage/Core/Model/Design/Package.php +++ b/app/code/core/Mage/Core/Model/Design/Package.php @@ -754,7 +754,7 @@ public function getMergedCssUrl($files) $files, $targetDir . DS . $targetFilename, false, - [$this, 'beforeMergeCss'], + $this->beforeMergeCss(...), 'css', ); if ($mergeFilesResult) { diff --git a/app/code/core/Mage/Core/Model/Email/Template.php b/app/code/core/Mage/Core/Model/Email/Template.php index bc9a347a50c..3ae6a84e6bf 100644 --- a/app/code/core/Mage/Core/Model/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Email/Template.php @@ -308,8 +308,8 @@ public function getProcessedTemplate(array $variables = []) $variables = $this->_addEmailVariables($variables, $processor->getStoreId()); $processor - ->setTemplateProcessor([$this, 'getTemplateByConfigPath']) - ->setIncludeProcessor([$this, 'getInclude']) + ->setTemplateProcessor($this->getTemplateByConfigPath(...)) + ->setIncludeProcessor($this->getInclude(...)) ->setVariables($variables); try { diff --git a/app/code/core/Mage/Core/Model/Email/Template/Abstract.php b/app/code/core/Mage/Core/Model/Email/Template/Abstract.php index 622aaf1cc1d..738f3e696a5 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Abstract.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Abstract.php @@ -256,7 +256,7 @@ protected function _getCssByConfig($configPath) return ''; } - $files = array_map('trim', explode(',', $filesToLoad)); + $files = array_map(trim(...), explode(',', $filesToLoad)); $css = ''; foreach ($files as $fileName) { diff --git a/app/code/core/Mage/Core/Model/Email/Template/Filter.php b/app/code/core/Mage/Core/Model/Email/Template/Filter.php index d1717705ee7..3a8a2c3f3d7 100644 --- a/app/code/core/Mage/Core/Model/Email/Template/Filter.php +++ b/app/code/core/Mage/Core/Model/Email/Template/Filter.php @@ -62,7 +62,7 @@ class Mage_Core_Model_Email_Template_Filter extends Varien_Filter_Template */ public function __construct() { - $this->_modifiers['escape'] = [$this, 'modifierEscape']; + $this->_modifiers['escape'] = $this->modifierEscape(...); $this->_permissionVariable = Mage::getModel('admin/variable'); $this->_permissionBlock = Mage::getModel('admin/block'); } diff --git a/app/code/core/Mage/Core/Model/Resource/Session.php b/app/code/core/Mage/Core/Model/Resource/Session.php index ac06ae709dd..4ea040e1f66 100644 --- a/app/code/core/Mage/Core/Model/Resource/Session.php +++ b/app/code/core/Mage/Core/Model/Resource/Session.php @@ -128,12 +128,12 @@ public function setSaveHandler() { if ($this->hasConnection()) { session_set_save_handler( - [$this, 'open'], - [$this, 'close'], - [$this, 'read'], - [$this, 'write'], - [$this, 'destroy'], - [$this, 'gc'], + $this->open(...), + $this->close(...), + $this->read(...), + $this->write(...), + $this->destroy(...), + $this->gc(...), ); } else { session_save_path(Mage::getBaseDir('session')); diff --git a/app/code/core/Mage/Core/Model/Resource/Setup.php b/app/code/core/Mage/Core/Model/Resource/Setup.php index d2b8a095e02..c244c1064e4 100644 --- a/app/code/core/Mage/Core/Model/Resource/Setup.php +++ b/app/code/core/Mage/Core/Model/Resource/Setup.php @@ -656,7 +656,7 @@ protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $ar switch ($actionType) { case self::TYPE_DB_INSTALL: case self::TYPE_DATA_INSTALL: - uksort($arrFiles, 'version_compare'); + uksort($arrFiles, version_compare(...)); foreach ($arrFiles as $version => $file) { if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { $arrRes[0] = [ @@ -670,7 +670,7 @@ protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $ar case self::TYPE_DB_UPGRADE: case self::TYPE_DATA_UPGRADE: - uksort($arrFiles, 'version_compare'); + uksort($arrFiles, version_compare(...)); foreach ($arrFiles as $version => $file) { $versionInfo = explode('-', $version); diff --git a/app/code/core/Mage/Core/Model/Url.php b/app/code/core/Mage/Core/Model/Url.php index b5d05fafe9e..828d74fac9a 100644 --- a/app/code/core/Mage/Core/Model/Url.php +++ b/app/code/core/Mage/Core/Model/Url.php @@ -1180,7 +1180,7 @@ public function sessionUrlVar($html) } else { return preg_replace_callback( '#(\?|&|&)___SID=([SU])(&|&)?#', - [$this, 'sessionVarCallback'], + $this->sessionVarCallback(...), $html, ); } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php b/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php index b35ea0ac521..f03ee5ac336 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Iterator.php @@ -27,7 +27,7 @@ public function walk() $callbacks[] = $adapterCb; } - $callbacks[] = [$this, 'updateProgress']; + $callbacks[] = $this->updateProgress(...); echo $this->_getProgressBarHtml($sessionId, $total['cnt']); diff --git a/app/code/core/Mage/Downloadable/Model/Product/Type.php b/app/code/core/Mage/Downloadable/Model/Product/Type.php index 6166339be82..f559970f6d1 100644 --- a/app/code/core/Mage/Downloadable/Model/Product/Type.php +++ b/app/code/core/Mage/Downloadable/Model/Product/Type.php @@ -474,7 +474,7 @@ public function isSalable($product = null) public function processBuyRequest($product, $buyRequest) { $links = $buyRequest->getLinks(); - $links = (is_array($links)) ? array_filter($links, '\intval') : []; + $links = (is_array($links)) ? array_filter($links, \intval(...)) : []; return ['links' => $links]; } diff --git a/app/code/core/Mage/Eav/Model/Attribute/Data/File.php b/app/code/core/Mage/Eav/Model/Attribute/Data/File.php index 0978be77f07..7a18ec96e24 100644 --- a/app/code/core/Mage/Eav/Model/Attribute/Data/File.php +++ b/app/code/core/Mage/Eav/Model/Attribute/Data/File.php @@ -91,7 +91,7 @@ protected function _validateByRules($value) if (!empty($rules['file_extensions'])) { $extensions = explode(',', $rules['file_extensions']); - $extensions = array_map('trim', $extensions); + $extensions = array_map(trim(...), $extensions); if (!in_array($extension, $extensions)) { return [ Mage::helper('eav')->__('"%s" is not a valid file extension.', $label), diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php index c7e502536dd..3067fef8730 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php @@ -539,7 +539,7 @@ public function getSortedAttributes($setId = null) } $this->_sortingSetId = $setId; - uasort($attributes, [$this, 'attributesCompare']); + uasort($attributes, $this->attributesCompare(...)); return $attributes; } diff --git a/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php index a62f9c17d05..a05d974c95b 100644 --- a/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/core/Mage/ImportExport/Block/Adminhtml/Export/Filter.php @@ -347,7 +347,7 @@ protected function _prepareColumns() 'header' => Mage::helper('importexport')->__('Filter'), 'sortable' => false, 'filter' => false, - 'frame_callback' => [$this, 'decorateFilter'], + 'frame_callback' => $this->decorateFilter(...), ]); if ($this->hasOperation()) { diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php index be5f0000bd5..cba04eae16f 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php @@ -382,9 +382,7 @@ public function getAttributeOptions(Mage_Eav_Model_Entity_Attribute_Abstract $at public function getBehavior() { if (!isset($this->_parameters['behavior']) - || ($this->_parameters['behavior'] != Mage_ImportExport_Model_Import::BEHAVIOR_APPEND - && $this->_parameters['behavior'] != Mage_ImportExport_Model_Import::BEHAVIOR_REPLACE - && $this->_parameters['behavior'] != Mage_ImportExport_Model_Import::BEHAVIOR_DELETE) + || (!in_array($this->_parameters['behavior'], [Mage_ImportExport_Model_Import::BEHAVIOR_APPEND, Mage_ImportExport_Model_Import::BEHAVIOR_REPLACE, Mage_ImportExport_Model_Import::BEHAVIOR_DELETE])) ) { return Mage_ImportExport_Model_Import::getDefaultBehavior(); } diff --git a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php index 2919bcd6244..da4051178e3 100644 --- a/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php +++ b/app/code/core/Mage/Index/Block/Adminhtml/Process/Grid.php @@ -120,7 +120,7 @@ protected function _prepareColumns() 'index' => 'status', 'type' => 'options', 'options' => $this->_processModel->getStatusesOptions(), - 'frame_callback' => [$this, 'decorateStatus'], + 'frame_callback' => $this->decorateStatus(...), ]); $this->addColumn('update_required', [ @@ -131,7 +131,7 @@ protected function _prepareColumns() 'index' => 'update_required', 'type' => 'options', 'options' => $this->_processModel->getUpdateRequiredOptions(), - 'frame_callback' => [$this, 'decorateUpdateRequired'], + 'frame_callback' => $this->decorateUpdateRequired(...), ]); $this->addColumn('ended_at', [ @@ -139,7 +139,7 @@ protected function _prepareColumns() 'type' => 'datetime', 'align' => 'left', 'index' => 'ended_at', - 'frame_callback' => [$this, 'decorateDate'], + 'frame_callback' => $this->decorateDate(...), ]); $this->addColumn( diff --git a/app/code/core/Mage/Newsletter/Model/Template.php b/app/code/core/Mage/Newsletter/Model/Template.php index 8fe1da00747..9f13ad0876d 100644 --- a/app/code/core/Mage/Newsletter/Model/Template.php +++ b/app/code/core/Mage/Newsletter/Model/Template.php @@ -195,8 +195,8 @@ public function getProcessedTemplate(array $variables = [], $usePreprocess = fal $variables = $this->_addEmailVariables($variables, $processor->getStoreId()); $processor - ->setTemplateProcessor([$this, 'getTemplateByConfigPath']) - ->setIncludeProcessor([$this, 'getInclude']) + ->setTemplateProcessor($this->getTemplateByConfigPath(...)) + ->setIncludeProcessor($this->getInclude(...)) ->setVariables($variables); // Filter the template text so that all HTML content will be present diff --git a/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php index 1e0d25f1b84..75f90e24493 100644 --- a/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php +++ b/app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/AuthorizedTokens/Grid.php @@ -66,13 +66,13 @@ protected function _prepareColumns() 'header' => $this->__('User Type'), //'index' => array('customer_id', 'admin_id'), 'options' => [0 => $this->__('Admin'), 1 => $this->__('Customer')], - 'frame_callback' => [$this, 'decorateUserType'], + 'frame_callback' => $this->decorateUserType(...), ]); $this->addColumn('user_id', [ 'header' => $this->__('User ID'), //'index' => array('customer_id', 'admin_id'), - 'frame_callback' => [$this, 'decorateUserId'], + 'frame_callback' => $this->decorateUserId(...), ]); /** @var Mage_Adminhtml_Model_System_Config_Source_Yesno $sourceYesNo */ diff --git a/app/code/core/Mage/Paygate/Helper/Data.php b/app/code/core/Mage/Paygate/Helper/Data.php index bd878a5ab6a..924443c0406 100644 --- a/app/code/core/Mage/Paygate/Helper/Data.php +++ b/app/code/core/Mage/Paygate/Helper/Data.php @@ -111,7 +111,7 @@ public function getExtendedTransactionMessage( $pattern .= ' %s'; $texts[] = $exception; - return call_user_func_array([$this, '__'], array_merge([$pattern], $texts)); + return call_user_func_array($this->__(...), array_merge([$pattern], $texts)); } /** diff --git a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php index a9154f08aff..c5bb93ede42 100644 --- a/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php +++ b/app/code/core/Mage/Paypal/Block/Adminhtml/System/Config/Fieldset/Deprecated.php @@ -106,7 +106,7 @@ public function isPaymentEnabledAnyScope($activityPath) */ public function render(Varien_Data_Form_Element_Abstract $element) { - $isPaymentEnabled = $this->_isPaymentEnabled($element, [$this, 'isPaymentEnabledAnyScope']); + $isPaymentEnabled = $this->_isPaymentEnabled($element, $this->isPaymentEnabledAnyScope(...)); if ($this->_wasActive($element) && $isPaymentEnabled) { return parent::render($element); } diff --git a/app/code/core/Mage/Paypal/Model/Api/Abstract.php b/app/code/core/Mage/Paypal/Model/Api/Abstract.php index 7063f2932c1..c9b6543664a 100644 --- a/app/code/core/Mage/Paypal/Model/Api/Abstract.php +++ b/app/code/core/Mage/Paypal/Model/Api/Abstract.php @@ -243,7 +243,7 @@ public function getBusinessAccount() */ public function &import($to, array $publicMap = []) { - return Varien_Object_Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $to, $publicMap); + return Varien_Object_Mapper::accumulateByMap($this->getDataUsingMethod(...), $to, $publicMap); } /** @@ -254,7 +254,7 @@ public function &import($to, array $publicMap = []) */ public function export($from, array $publicMap = []) { - Varien_Object_Mapper::accumulateByMap($from, [$this, 'setDataUsingMethod'], $publicMap); + Varien_Object_Mapper::accumulateByMap($from, $this->setDataUsingMethod(...), $publicMap); return $this; } @@ -325,7 +325,7 @@ protected function &_exportToRequest(array $privateRequestMap, array $request = } } - $result = Varien_Object_Mapper::accumulateByMap([$this, 'getDataUsingMethod'], $request, $map); + $result = Varien_Object_Mapper::accumulateByMap($this->getDataUsingMethod(...), $request, $map); foreach ($privateRequestMap as $key) { if (isset($this->_exportToRequestFilters[$key]) && isset($result[$key])) { $callback = $this->_exportToRequestFilters[$key]; @@ -355,7 +355,7 @@ protected function _importFromResponse(array $privateResponseMap, array $respons } } - Varien_Object_Mapper::accumulateByMap($response, [$this, 'setDataUsingMethod'], $map); + Varien_Object_Mapper::accumulateByMap($response, $this->setDataUsingMethod(...), $map); } /** diff --git a/app/code/core/Mage/Paypal/Model/Express/Checkout.php b/app/code/core/Mage/Paypal/Model/Express/Checkout.php index 33d455e5dd2..4cdc2d144b3 100644 --- a/app/code/core/Mage/Paypal/Model/Express/Checkout.php +++ b/app/code/core/Mage/Paypal/Model/Express/Checkout.php @@ -869,7 +869,7 @@ protected function _prepareShippingOptions( // Magento will transfer only first 10 cheapest shipping options if there are more than 10 available. if (count($options) > 10) { - usort($options, [static::class,'cmpShippingOptions']); + usort($options, static::cmpShippingOptions(...)); array_splice($options, 10); // User selected option will be always included in options list if (!is_null($userSelectedOption) && !in_array($userSelectedOption, $options)) { diff --git a/app/code/core/Mage/Paypal/Model/Info.php b/app/code/core/Mage/Paypal/Model/Info.php index 78f2f9caca4..6679c87fdf3 100644 --- a/app/code/core/Mage/Paypal/Model/Info.php +++ b/app/code/core/Mage/Paypal/Model/Info.php @@ -221,7 +221,7 @@ public function importToPayment($from, Mage_Payment_Model_Info $payment) $from = [$from, 'getDataUsingMethod']; } - Varien_Object_Mapper::accumulateByMap($from, [$payment, 'setAdditionalInformation'], $fullMap); + Varien_Object_Mapper::accumulateByMap($from, $payment->setAdditionalInformation(...), $fullMap); } /** @@ -234,7 +234,7 @@ public function &exportFromPayment(Mage_Payment_Model_Info $payment, $to, ?array { $fullMap = array_merge($this->_paymentMap, $this->_systemMap); Varien_Object_Mapper::accumulateByMap( - [$payment, 'getAdditionalInformation'], + $payment->getAdditionalInformation(...), $to, $map ? $map : array_flip($fullMap), ); diff --git a/app/code/core/Mage/Paypal/Model/Payflowlink.php b/app/code/core/Mage/Paypal/Model/Payflowlink.php index e365ebd48dc..5d13ed6a39c 100644 --- a/app/code/core/Mage/Paypal/Model/Payflowlink.php +++ b/app/code/core/Mage/Paypal/Model/Payflowlink.php @@ -340,9 +340,7 @@ protected function _getOrderFromResponse() return false; } - if ($response->getResult() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER - && $response->getResult() != self::RESPONSE_CODE_DECLINED_BY_FILTER - && $response->getResult() != self::RESPONSE_CODE_APPROVED + if (!in_array($response->getResult(), [self::RESPONSE_CODE_FRAUDSERVICE_FILTER, self::RESPONSE_CODE_DECLINED_BY_FILTER, self::RESPONSE_CODE_APPROVED]) ) { if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) { $order->registerCancellation($response->getRespmsg())->save(); diff --git a/app/code/core/Mage/Rating/Model/Resource/Rating.php b/app/code/core/Mage/Rating/Model/Resource/Rating.php index 7d9c87f39cd..5d76dc5921c 100644 --- a/app/code/core/Mage/Rating/Model/Resource/Rating.php +++ b/app/code/core/Mage/Rating/Model/Resource/Rating.php @@ -126,7 +126,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) ->from($ratingTitleTable, ['store_id', 'value']) ->where('rating_id = :rating_id'); $old = $adapter->fetchPairs($select, [':rating_id' => $ratingId]); - $new = array_filter(array_map('trim', $object->getRatingCodes())); + $new = array_filter(array_map(trim(...), $object->getRatingCodes())); $insert = array_diff_assoc($new, $old); $delete = array_diff_assoc($old, $new); diff --git a/app/code/core/Mage/Rss/Block/Catalog/New.php b/app/code/core/Mage/Rss/Block/Catalog/New.php index a107e5e803e..d5ef564bad6 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/New.php +++ b/app/code/core/Mage/Rss/Block/Catalog/New.php @@ -87,7 +87,7 @@ protected function _toHtml() */ Mage::getSingleton('core/resource_iterator')->walk( $products->getSelect(), - [[$this, 'addNewItemXmlCallback']], + [$this->addNewItemXmlCallback(...)], ['rssObj' => $rssObj, 'product' => $product], ); diff --git a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php index d5c52aa03f3..484706d718a 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php @@ -78,7 +78,7 @@ protected function _toHtml() */ Mage::getSingleton('core/resource_iterator')->walk( $collection->getSelect(), - [[$this, 'addNotifyItemXmlCallback']], + [$this->addNotifyItemXmlCallback(...)], ['rssObj' => $rssObj, 'product' => $product, 'globalQty' => $globalNotifyStockQty], ); diff --git a/app/code/core/Mage/Rss/Block/Catalog/Review.php b/app/code/core/Mage/Rss/Block/Catalog/Review.php index be65810492d..5bb61afe5e0 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Review.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Review.php @@ -65,7 +65,7 @@ protected function _toHtml() Mage::getSingleton('core/resource_iterator')->walk( $collection->getSelect(), - [[$this, 'addReviewItemXmlCallback']], + [$this->addReviewItemXmlCallback(...)], ['rssObj' => $rssObj, 'reviewModel' => $reviewModel], ); return $rssObj->createRssXml(); diff --git a/app/code/core/Mage/Rss/Block/Catalog/Special.php b/app/code/core/Mage/Rss/Block/Catalog/Special.php index a25c6d06494..13428545781 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Special.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Special.php @@ -90,7 +90,7 @@ protected function _toHtml() */ Mage::getSingleton('core/resource_iterator')->walk( $specials->getSelect(), - [[$this, 'addSpecialXmlCallback']], + [$this->addSpecialXmlCallback(...)], ['rssObj' => $rssObj, 'results' => &$results], ); diff --git a/app/code/core/Mage/Rss/Block/Catalog/Tag.php b/app/code/core/Mage/Rss/Block/Catalog/Tag.php index 82aef2ae12e..61fa0c83b22 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Tag.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Tag.php @@ -61,7 +61,7 @@ protected function _toHtml() $resourceHelper = Mage::getResourceHelper('core'); Mage::getSingleton('core/resource_iterator')->walk( $resourceHelper->getQueryUsingAnalyticFunction($collection->getSelect()), - [[$this, 'addTaggedItemXml']], + [$this->addTaggedItemXml(...)], ['rssObj' => $rssObj, 'product' => $product], $collection->getSelect()->getAdapter(), ); diff --git a/app/code/core/Mage/Rss/Block/Order/New.php b/app/code/core/Mage/Rss/Block/Order/New.php index 5399753c173..34fbbb026b8 100644 --- a/app/code/core/Mage/Rss/Block/Order/New.php +++ b/app/code/core/Mage/Rss/Block/Order/New.php @@ -69,7 +69,7 @@ protected function _toHtml() Mage::dispatchEvent('rss_order_new_collection_select', ['collection' => $collection]); Mage::getSingleton('core/resource_iterator') - ->walk($collection->getSelect(), [[$this, 'addNewOrderXmlCallback']], ['rssObj' => $rssObj, 'order' => $order , 'detailBlock' => $detailBlock]); + ->walk($collection->getSelect(), [$this->addNewOrderXmlCallback(...)], ['rssObj' => $rssObj, 'order' => $order , 'detailBlock' => $detailBlock]); return $rssObj->createRssXml(); } diff --git a/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php b/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php index 67809b0e892..dedd4ea3227 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php +++ b/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php @@ -80,9 +80,9 @@ public function bindArrayOfIds($value) $value = explode(',', $value); } - $value = array_map('trim', $value); + $value = array_map(trim(...), $value); - return array_filter($value, 'is_numeric'); + return array_filter($value, is_numeric(...)); } /** diff --git a/app/code/core/Mage/Sales/Block/Order/Totals.php b/app/code/core/Mage/Sales/Block/Order/Totals.php index e5a94751817..a748872469c 100644 --- a/app/code/core/Mage/Sales/Block/Order/Totals.php +++ b/app/code/core/Mage/Sales/Block/Order/Totals.php @@ -158,7 +158,7 @@ protected function _initTotals() */ public function addTotal(Varien_Object $total, $after = null) { - if ($after !== null && $after != 'last' && $after != 'first') { + if (!in_array($after, [null, 'last', 'first'])) { $totals = []; $added = false; foreach ($this->_totals as $code => $item) { diff --git a/app/code/core/Mage/Sales/Model/Resource/Setup.php b/app/code/core/Mage/Sales/Model/Resource/Setup.php index 6e2445c8569..7801aef8c48 100644 --- a/app/code/core/Mage/Sales/Model/Resource/Setup.php +++ b/app/code/core/Mage/Sales/Model/Resource/Setup.php @@ -64,7 +64,7 @@ class Mage_Sales_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup protected function _flatTableExist($table) { $tablesList = $this->getConnection()->listTables(); - return in_array(strtoupper($this->getTable($table)), array_map('strtoupper', $tablesList)); + return in_array(strtoupper($this->getTable($table)), array_map(strtoupper(...), $tablesList)); } /** diff --git a/app/code/core/Mage/Sales/Model/Service/Quote.php b/app/code/core/Mage/Sales/Model/Service/Quote.php index b6359a9cba7..16384d6d383 100644 --- a/app/code/core/Mage/Sales/Model/Service/Quote.php +++ b/app/code/core/Mage/Sales/Model/Service/Quote.php @@ -163,8 +163,8 @@ public function submitOrder() $order->setQuote($quote); $transaction->addObject($order); - $transaction->addCommitCallback([$order, 'place']); - $transaction->addCommitCallback([$order, 'save']); + $transaction->addCommitCallback($order->place(...)); + $transaction->addCommitCallback($order->save(...)); Mage::unregister('current_order'); Mage::register('current_order', $order); diff --git a/app/code/core/Mage/Uploader/Block/Abstract.php b/app/code/core/Mage/Uploader/Block/Abstract.php index 56935070999..f1ba96b1a4a 100644 --- a/app/code/core/Mage/Uploader/Block/Abstract.php +++ b/app/code/core/Mage/Uploader/Block/Abstract.php @@ -235,6 +235,6 @@ public function getElementId($suffix) */ protected function _prepareElementsIds($targets) { - return array_map([$this, 'getElementId'], array_unique(array_values($targets))); + return array_map($this->getElementId(...), array_unique(array_values($targets))); } } diff --git a/app/code/core/Mage/Uploader/Helper/File.php b/app/code/core/Mage/Uploader/Helper/File.php index d92fc168f71..76f5fa56e54 100644 --- a/app/code/core/Mage/Uploader/Helper/File.php +++ b/app/code/core/Mage/Uploader/Helper/File.php @@ -667,10 +667,10 @@ public function getMimeTypes() public function getMimeTypeFromExtensionList($extensionsList) { if (is_string($extensionsList)) { - $extensionsList = array_map('trim', explode(',', $extensionsList)); + $extensionsList = array_map(trim(...), explode(',', $extensionsList)); } - return array_map([$this, 'getMimeTypeByExtension'], $extensionsList); + return array_map($this->getMimeTypeByExtension(...), $extensionsList); } /** diff --git a/cron.php b/cron.php index 0730f923b40..a887c8edaee 100644 --- a/cron.php +++ b/cron.php @@ -29,7 +29,7 @@ umask(0); -$disabledFuncs = array_map('trim', preg_split("/,|\s+/", strtolower(ini_get('disable_functions')))); +$disabledFuncs = array_map(trim(...), preg_split("/,|\s+/", strtolower(ini_get('disable_functions')))); $isWinOS = !str_contains(strtolower(PHP_OS), 'darwin') && str_contains(strtolower(PHP_OS), 'win'); $isShellDisabled = in_array('shell_exec', $disabledFuncs) || $isWinOS diff --git a/errors/processor.php b/errors/processor.php index a49af29ad8e..8eba055c376 100644 --- a/errors/processor.php +++ b/errors/processor.php @@ -392,7 +392,7 @@ public function saveReport(array $reportData) @mkdir($this->_reportDir, 0750, true); } - $reportData = array_map('strip_tags', $reportData); + $reportData = array_map(strip_tags(...), $reportData); @file_put_contents($this->_reportFile, serialize($reportData)); @chmod($this->_reportFile, 0640); diff --git a/lib/Mage/HTTP/Client/Curl.php b/lib/Mage/HTTP/Client/Curl.php index f97d0504f5d..80335780639 100644 --- a/lib/Mage/HTTP/Client/Curl.php +++ b/lib/Mage/HTTP/Client/Curl.php @@ -257,7 +257,7 @@ public function getCookies() continue; } - [$key, $val] = array_pad(array_map('trim', explode('=', $values[0])), 2, null); + [$key, $val] = array_pad(array_map(trim(...), explode('=', $values[0])), 2, null); if (is_null($val) || !strlen($key)) { continue; } @@ -287,7 +287,7 @@ public function getCookiesFull() continue; } - [$key, $val] = array_pad(array_map('trim', explode('=', $values[0])), 2, null); + [$key, $val] = array_pad(array_map(trim(...), explode('=', $values[0])), 2, null); if (is_null($val) || !strlen($key)) { continue; } diff --git a/lib/Mage/HTTP/Client/Socket.php b/lib/Mage/HTTP/Client/Socket.php index 5a7ddd45faf..cf96e18c425 100644 --- a/lib/Mage/HTTP/Client/Socket.php +++ b/lib/Mage/HTTP/Client/Socket.php @@ -289,7 +289,7 @@ public function getCookies() continue; } - [$key, $val] = array_pad(array_map('trim', explode('=', $values[0])), 2, null); + [$key, $val] = array_pad(array_map(trim(...), explode('=', $values[0])), 2, null); if (is_null($val) || !strlen($key)) { continue; } @@ -319,7 +319,7 @@ public function getCookiesFull() continue; } - [$key, $val] = array_pad(array_map('trim', explode('=', $values[0])), 2, null); + [$key, $val] = array_pad(array_map(trim(...), explode('=', $values[0])), 2, null); if (is_null($val) || !strlen($key)) { continue; } diff --git a/lib/Varien/Data/Collection/Filesystem.php b/lib/Varien/Data/Collection/Filesystem.php index f45f82a8a74..ebaab9ae77f 100644 --- a/lib/Varien/Data/Collection/Filesystem.php +++ b/lib/Varien/Data/Collection/Filesystem.php @@ -470,78 +470,78 @@ public function addFieldToFilter($field, $cond, $type = 'and') // simply check whether equals if (!is_array($cond)) { - return $this->addCallbackFilter($field, $cond, $type, [$this, 'filterCallbackEq']); + return $this->addCallbackFilter($field, $cond, $type, $this->filterCallbackEq(...)); } // versatile filters if (isset($cond['from']) || isset($cond['to'])) { $this->_addFilterBracket('(', 'and' === $type); if (isset($cond['from'])) { - $this->addCallbackFilter($field, $cond['from'], 'and', [$this, 'filterCallbackIsLessThan'], $inverted); + $this->addCallbackFilter($field, $cond['from'], 'and', $this->filterCallbackIsLessThan(...), $inverted); } if (isset($cond['to'])) { - $this->addCallbackFilter($field, $cond['to'], 'and', [$this, 'filterCallbackIsMoreThan'], $inverted); + $this->addCallbackFilter($field, $cond['to'], 'and', $this->filterCallbackIsMoreThan(...), $inverted); } return $this->_addFilterBracket(')'); } if (isset($cond['eq'])) { - return $this->addCallbackFilter($field, $cond['eq'], $type, [$this, 'filterCallbackEq']); + return $this->addCallbackFilter($field, $cond['eq'], $type, $this->filterCallbackEq(...)); } if (isset($cond['neq'])) { - return $this->addCallbackFilter($field, $cond['neq'], $type, [$this, 'filterCallbackEq'], $inverted); + return $this->addCallbackFilter($field, $cond['neq'], $type, $this->filterCallbackEq(...), $inverted); } if (isset($cond['like'])) { - return $this->addCallbackFilter($field, $cond['like'], $type, [$this, 'filterCallbackLike']); + return $this->addCallbackFilter($field, $cond['like'], $type, $this->filterCallbackLike(...)); } if (isset($cond['nlike'])) { - return $this->addCallbackFilter($field, $cond['nlike'], $type, [$this, 'filterCallbackLike'], $inverted); + return $this->addCallbackFilter($field, $cond['nlike'], $type, $this->filterCallbackLike(...), $inverted); } if (isset($cond['in'])) { - return $this->addCallbackFilter($field, $cond['in'], $type, [$this, 'filterCallbackInArray']); + return $this->addCallbackFilter($field, $cond['in'], $type, $this->filterCallbackInArray(...)); } if (isset($cond['nin'])) { - return $this->addCallbackFilter($field, $cond['nin'], $type, [$this, 'filterCallbackInArray'], $inverted); + return $this->addCallbackFilter($field, $cond['nin'], $type, $this->filterCallbackInArray(...), $inverted); } if (isset($cond['notnull'])) { - return $this->addCallbackFilter($field, $cond['notnull'], $type, [$this, 'filterCallbackIsNull'], $inverted); + return $this->addCallbackFilter($field, $cond['notnull'], $type, $this->filterCallbackIsNull(...), $inverted); } if (isset($cond['null'])) { - return $this->addCallbackFilter($field, $cond['null'], $type, [$this, 'filterCallbackIsNull']); + return $this->addCallbackFilter($field, $cond['null'], $type, $this->filterCallbackIsNull(...)); } if (isset($cond['moreq'])) { - return $this->addCallbackFilter($field, $cond['moreq'], $type, [$this, 'filterCallbackIsLessThan'], $inverted); + return $this->addCallbackFilter($field, $cond['moreq'], $type, $this->filterCallbackIsLessThan(...), $inverted); } if (isset($cond['gt'])) { - return $this->addCallbackFilter($field, $cond['gt'], $type, [$this, 'filterCallbackIsMoreThan']); + return $this->addCallbackFilter($field, $cond['gt'], $type, $this->filterCallbackIsMoreThan(...)); } if (isset($cond['lt'])) { - return $this->addCallbackFilter($field, $cond['lt'], $type, [$this, 'filterCallbackIsLessThan']); + return $this->addCallbackFilter($field, $cond['lt'], $type, $this->filterCallbackIsLessThan(...)); } if (isset($cond['gteq'])) { - return $this->addCallbackFilter($field, $cond['gteq'], $type, [$this, 'filterCallbackIsLessThan'], $inverted); + return $this->addCallbackFilter($field, $cond['gteq'], $type, $this->filterCallbackIsLessThan(...), $inverted); } if (isset($cond['lteq'])) { - return $this->addCallbackFilter($field, $cond['lteq'], $type, [$this, 'filterCallbackIsMoreThan'], $inverted); + return $this->addCallbackFilter($field, $cond['lteq'], $type, $this->filterCallbackIsMoreThan(...), $inverted); } if (isset($cond['finset'])) { $filterValue = ($cond['finset'] ? explode(',', $cond['finset']) : []); - return $this->addCallbackFilter($field, $filterValue, $type, [$this, 'filterCallbackInArray']); + return $this->addCallbackFilter($field, $filterValue, $type, $this->filterCallbackInArray(...)); } // add OR recursively diff --git a/lib/Varien/Db/Adapter/Pdo/Mysql.php b/lib/Varien/Db/Adapter/Pdo/Mysql.php index 3439a8e58ee..6875ac50611 100644 --- a/lib/Varien/Db/Adapter/Pdo/Mysql.php +++ b/lib/Varien/Db/Adapter/Pdo/Mysql.php @@ -1767,10 +1767,7 @@ public function describeTable($tableName, $schemaName = null) $ddl = $this->loadDdlCache($cacheKey, self::DDL_DESCRIBE); if ($ddl === false) { $ddl = array_map( - [ - $this, - 'decorateTableInfo', - ], + $this->decorateTableInfo(...), parent::describeTable($tableName, $schemaName), ); /** @@ -2369,7 +2366,7 @@ protected function _getColumnsDefinition(Varien_Db_Ddl_Table $table) // PRIMARY KEY if (!empty($primary)) { asort($primary, SORT_NUMERIC); - $primary = array_map([$this, 'quoteIdentifier'], array_keys($primary)); + $primary = array_map($this->quoteIdentifier(...), array_keys($primary)); $definition[] = sprintf(' PRIMARY KEY (%s)', implode(', ', $primary)); } @@ -3645,7 +3642,7 @@ public function insertFromSelect(Varien_Db_Select $select, $table, array $fields $query = sprintf('%s INTO %s', $query, $this->quoteIdentifier($table)); if ($fields) { - $columns = array_map([$this, 'quoteIdentifier'], $fields); + $columns = array_map($this->quoteIdentifier(...), $fields); $query = sprintf('%s (%s)', $query, implode(', ', $columns)); } @@ -3971,7 +3968,7 @@ protected function _prepareInsertData($row, &$bind) protected function _getInsertSqlQuery($tableName, array $columns, array $values) { $tableName = $this->quoteIdentifier($tableName, true); - $columns = array_map([$this, 'quoteIdentifier'], $columns); + $columns = array_map($this->quoteIdentifier(...), $columns); $columns = implode(',', $columns); $values = implode(', ', $values); diff --git a/shell/indexer.php b/shell/indexer.php index df2080d933d..eefb19fec9f 100644 --- a/shell/indexer.php +++ b/shell/indexer.php @@ -46,7 +46,7 @@ protected function _parseIndexerString($string) } } elseif (!empty($string)) { $codes = explode(',', $string); - $codes = array_map('trim', $codes); + $codes = array_map(trim(...), $codes); $processes = $this->_getIndexer()->getProcessesCollectionByCodes($codes); foreach ($processes as $key => $process) { if ($process->getIndexer()->getVisibility() === false) { From 05252bcd866c0b2fcd1ca9051677a41da7d7af67 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Mon, 27 Oct 2025 06:19:46 +0100 Subject: [PATCH 2/3] fix --- .../Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php index 4af07e46062..cda64734e36 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Tab/History.php @@ -109,7 +109,7 @@ public function getFullHistory() ); } - usort($history, $this->_sortHistoryByTimestamp(...)); + usort($history, [self::class, '_sortHistoryByTimestamp']); return $history; } @@ -284,7 +284,7 @@ public function isCustomerNotificationNotApplicable($historyItem) * @return int */ // phpcs:ignore Ecg.PHP.PrivateClassMember.PrivateClassMemberError - private function _sortHistoryByTimestamp($a, $b) + private static function _sortHistoryByTimestamp($a, $b) { $createdAtA = $a['created_at']; $createdAtB = $b['created_at']; From f24696037928c1c625185c700c501b8c958f8c42 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Mon, 27 Oct 2025 06:30:11 +0100 Subject: [PATCH 3/3] rector --- .rector.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.rector.php b/.rector.php index 09506ed2bd6..bb2261d20d4 100644 --- a/.rector.php +++ b/.rector.php @@ -52,6 +52,7 @@ CodeQuality\Class_\CompleteDynamicPropertiesRector::class, # todo: TMP (!?!) CodeQuality\Class_\InlineConstructorDefaultToPropertyRector::class, # todo: TMP CodeQuality\ClassMethod\ExplicitReturnNullRector::class, # todo: TMP + CodeQuality\ClassMethod\LocallyCalledStaticMethodToNonStaticRector::class, # todo: TMP CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class, # todo: TMP CodeQuality\Equal\UseIdenticalOverEqualWithSameTypeRector::class, # todo: TMP CodeQuality\Expression\InlineIfToExplicitIfRector::class, # todo: TMP (!?!)