Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Cache/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ protected function _prepareColumns()
'type' => 'text',
'index' => 'state',
'width' => '250px',
'frame_callback' => [$this, 'decorateState'],
'frame_callback' => $this->decorateState(...),
]);

$this->addColumn('unassign', [
'header' => Mage::helper('sales')->__('Action'),
'index' => 'unassign',
'width' => '100px',
'type' => 'text',
'frame_callback' => [$this, 'decorateAction'],
'frame_callback' => $this->decorateAction(...),
'sortable' => false,
'filter' => false,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getOrderStoreName()
$store->getGroup()->getName(),
$store->getName(),
];
return implode('<br/>', array_map([$this, 'escapeHtml'], $name));
return implode('<br/>', array_map($this->escapeHtml(...), $name));
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function getFullHistory()
);
}

usort($history, [self::class, '_sortHistoryByTimestamp']);
usort($history, $this->_sortHistoryByTimestamp(...));
return $history;
}

Expand Down Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ protected function _checkIsForcedFormKeyAction()
{
return in_array(
strtolower($this->getRequest()->getActionName()),
array_map('strtolower', $this->_forcedFormKeyActions),
array_map(strtolower(...), $this->_forcedFormKeyActions),
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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]);
Expand Down
3 changes: 1 addition & 2 deletions app/code/core/Mage/Api/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Block/Adminhtml/Roles/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Model/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function getRequestedAttributes()
$include = explode(',', $include);
}

return array_map('trim', $include);
return array_map(trim(...), $include);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions app/code/core/Mage/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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()])) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Model/Product/Type/Grouped.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogInventory/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogRule/Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/CatalogSearch/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/ConfigurableSwatches/Helper/Productimg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function getConfigKey(string $configKey): array
static::ENV_KEY_SEPARATOR,
$configKey,
),
'trim',
trim(...),
);
[$unused, $scope] = $configKeyParts;
return [$configKeyParts, $scope];
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Design/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ public function getMergedCssUrl($files)
$files,
$targetDir . DS . $targetFilename,
false,
[$this, 'beforeMergeCss'],
$this->beforeMergeCss(...),
'css',
);
if ($mergeFilesResult) {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Model/Email/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Email/Template/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Email/Template/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Loading