Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 .phpstan.dist.baselines/_loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
__DIR__ . '/cast.useless.php',
__DIR__ . '/catch.neverThrown.php',
__DIR__ . '/class.extendsDeprecatedClass.php',
__DIR__ . '/class.nameCase.php',
__DIR__ . '/class.notFound.php',
__DIR__ . '/classConstant.deprecatedClass.php',
__DIR__ . '/clone.nonObject.php',
Expand Down
5 changes: 0 additions & 5 deletions .phpstan.dist.baselines/argument.type.php
Original file line number Diff line number Diff line change
Expand Up @@ -8921,11 +8921,6 @@
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Object.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Parameter #2 ...$arrays of function array_intersect_key expects array, array|null given.',
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Object.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Parameter #2 $array of function array_key_exists expects array, array|object given.',
'count' => 1,
Expand Down
10 changes: 0 additions & 10 deletions .phpstan.dist.baselines/class.nameCase.php

This file was deleted.

2 changes: 1 addition & 1 deletion .phpstan.dist.baselines/empty.notAllowed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,7 @@
];
$ignoreErrors[] = [
'rawMessage' => 'Construct empty() is not allowed. Use more strict comparison.',
'count' => 11,
'count' => 10,
'path' => __DIR__ . '/../lib/Varien/Object.php',
];
$ignoreErrors[] = [
Expand Down
5 changes: 0 additions & 5 deletions .phpstan.dist.baselines/offsetAccess.notFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Image/Adapter/Gd2.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Offset (int|string) might not exist on array|null.',
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Object.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Offset 0 might not exist on array<static(Varien_Simplexml_Element)>|null.',
'count' => 1,
Expand Down
155 changes: 0 additions & 155 deletions .phpstan.dist.baselines/variable.implicitArray.php
Original file line number Diff line number Diff line change
@@ -1,161 +1,21 @@
<?php declare(strict_types = 1);

$ignoreErrors = [];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $config does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/Block/Catalog/Helper/Form/Wysiwyg/Content.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $actions does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $actions might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/Block/Newsletter/Template/Grid/Renderer/Action.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Packaging.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/View/Form.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $params does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/controllers/TagController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Adminhtml/controllers/TagController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $defaultValues might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $params does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Catalog/Block/Layer/State.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $params does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $path does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Catalog/Model/Product/Image.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $updateCond does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Catalog/Model/Resource/Product.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $pricing does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $search does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/CatalogIndex/Model/Indexer/Minimalprice.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $conditions does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Abstract.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $conditions does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/CatalogIndex/Model/Resource/Indexer/Minimalprice.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $termKeys might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/CatalogSearch/Block/Term.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $result might not exist.',
'count' => 3,
'path' => __DIR__ . '/../app/code/core/Mage/Checkout/controllers/OnepageController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Cms/Model/Resource/Page/Collection.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $options might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Core/Model/File/Validator/AvailablePath.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $value does not exist.',
'count' => 2,
'path' => __DIR__ . '/../app/code/core/Mage/CurrencySymbol/Model/System/Currencysymbol.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $fields might not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Dataflow/Model/Session/Parser/Csv.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $dataToInsert does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Downloadable/Model/Resource/Link.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $data does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $toplinkInfo does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Page/Block/Html/Toplinks.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $result does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Paygate/controllers/Adminhtml/Paygate/Authorizenet/PaymentController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $result does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Paygate/controllers/Authorizenet/PaymentController.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $lines does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Sales/Model/Order/Pdf/Creditmemo.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $lines does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Sales/Model/Order/Pdf/Invoice.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $lines does not exist.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Sales/Model/Order/Pdf/Shipment.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $itemCollsX might not exist.',
'count' => 1,
Expand Down Expand Up @@ -201,20 +61,5 @@
'count' => 2,
'path' => __DIR__ . '/../lib/Varien/Convert/Parser/Csv.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $group does not exist.',
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Io/File.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $owner does not exist.',
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Io/File.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Implicit array creation is not allowed - variable $world does not exist.',
'count' => 1,
'path' => __DIR__ . '/../lib/Varien/Io/File.php',
];

return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
5 changes: 0 additions & 5 deletions .phpstan.dist.baselines/variable.undefined.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
'count' => 2,
'path' => __DIR__ . '/../app/code/core/Mage/Api2/Model/Acl/Global/Rule/Tree.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Variable $defaultValues might not be defined.',
'count' => 1,
'path' => __DIR__ . '/../app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php',
];
$ignoreErrors[] = [
'rawMessage' => 'Variable $productId might not be defined.',
'count' => 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected function _prepareForm()
{
$form = new Varien_Data_Form(['id' => 'wysiwyg_edit_form', 'action' => $this->getDataByKey('action'), 'method' => 'post']);

$config = [];
$config['document_base_url'] = $this->getDataByKey('store_media_url');
$config['store_id'] = $this->getDataByKey('store_id');
$config['add_variables'] = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Mage_Adminhtml_Block_Newsletter_Template_Grid_Renderer_Action extends Mage
#[Override]
public function render(Varien_Object $row)
{
$actions = [];

if ($row->isValidForSend()) {
$actions[] = [
'url' => $this->getUrl('*/newsletter_queue/edit', ['template_id' => $row->getId()]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* @package Mage_Adminhtml
*/


/**
* Adminhtml shipment packaging
*
Expand Down Expand Up @@ -266,6 +265,7 @@ public function getDeliveryConfirmationTypes()
*/
public function getPrintButton()
{
$data = [];
$data['shipment_id'] = $this->getShipment()->getId();
$url = $this->getUrl('*/sales_order_shipment/printPackage', $data);
return $this->getLayout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getCreateLabelButton()
*/
public function getPrintLabelButton()
{
$data = [];
$data['shipment_id'] = $this->getShipment()->getId();
$url = $this->getUrl('*/sales_order_shipment/printLabel', $data);
return $this->getLayout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function addAction()
*/
public function editAction()
{
$params = [];
$params['_current'] = true;
$redirect = false;

Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ public function editAction()

/**
* Save tag action
* @return $this|void
* @return $this
*/
public function saveAction()
{
$data = [];

if ($postData = $this->getRequest()->getPost()) {
if (isset($postData['tag_id'])) {
$data['tag_id'] = $postData['tag_id'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,23 @@ public function hasOptions()
public function getJsonConfig()
{
Mage::app()->getLocale()->getJsPriceFormat();
$optionsArray = $this->getOptions();
$options = [];
$selected = [];
$currentProduct = $this->getProduct();
$options = [];
$selected = [];
$defaultValues = [];

/** @var Mage_Core_Helper_Data $coreHelper */
$coreHelper = Mage::helper('core');
/** @var Mage_Bundle_Model_Product_Price $bundlePriceModel */
$bundlePriceModel = Mage::getModel('bundle/product_price');

$currentProduct = $this->getProduct();
$preConfiguredFlag = $currentProduct->hasPreconfiguredValues();
if ($preConfiguredFlag) {
$preConfiguredValues = $currentProduct->getPreconfiguredValues();
$defaultValues = [];
}

$position = 0;
$optionsArray = $this->getOptions();
foreach ($optionsArray as $bundleOption) {
/** @var Mage_Bundle_Model_Option $bundleOption */
if (!$bundleOption->getSelections()) {
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Catalog/Block/Layer/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public function getClearUrl()
$filterState[$filter->getRequestVar()] = $filter->getCleanValue();
}

$params = [];
$params['_current'] = true;
$params['_use_rewrite'] = true;
$params['_query'] = $filterState;
$params['_escape'] = true;

Comment on lines +56 to +61
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to have $params = [ ... ]?

with [ ... ] being a Multiline Array?

Or better return Mage::getUrl('*/*/*', [ ... ]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be to much work.

Lets keep it simple.

Copy link
Copy Markdown
Contributor

@Hanmac Hanmac Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sreichel i meant to write the params array like this:

$params = [
    '_current'     => true,
    '_use_rewrite' => true,
    '_query'       => $filterState,
    '_escape'      => true,
];

or like this:

return Mage::getUrl('*/*/*', [
    '_current'     => true,
    '_use_rewrite' => true,
    '_query'       => $filterState,
    '_escape'      => true,
]);

i found a rector for similar stuff, but not quite the right thing:
https://getrector.com/rule-detail/inline-array-return-assign-rector

Edit: i asked if there is an extra rule: rectorphp/rector#9747
there isn't one right now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, to automate it, but atm i dont wont to spent much time for writing rules.

(there should be some project/OM-related rules first e.g. change to getDataById())

btw ... we also have CodeSniffer/Beatifier, cs-fixer with additional ECS rules, but no one covers this

return Mage::getUrl('*/*/*', $params);
}

Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ public function getUrl()
public function getRemoveUrl()
{
$query = [$this->getFilter()->getRequestVar() => $this->getFilter()->getResetValue()];

$params = [];
$params['_current'] = true;
$params['_use_rewrite'] = true;
$params['_query'] = $query;
$params['_escape'] = true;

return Mage::getUrl('*/*/*', $params);
}

Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Catalog/Model/Product/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,15 @@ public function setBaseFile($file)
$this->_baseFile = $baseFile;

// build new filename (most important params)
$path = [];

$path = [
self::$_baseMediaPath,
'cache',
Mage::app()->getStore()->getId(),
$path[] = $this->getDestinationSubdir(),
Comment thread
sreichel marked this conversation as resolved.
];

if ((!empty($this->_width)) || (!empty($this->_height))) {
$path[] = "{$this->_width}x{$this->_height}";
}
Expand Down
9 changes: 6 additions & 3 deletions app/code/core/Mage/Catalog/Model/Resource/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,12 @@ public function duplicate($oldId, $newId)
$statusAttribute = $this->getAttribute('status');
$statusAttributeId = $statusAttribute->getAttributeId();
$statusAttributeTable = $statusAttribute->getBackend()->getTable();
$updateCond[] = 'store_id > 0';
$updateCond[] = $adapter->quoteInto('entity_id = ?', $newId);
$updateCond[] = $adapter->quoteInto('attribute_id = ?', $statusAttributeId);

$updateCond = [];
$updateCond[] = 'store_id > 0';
$updateCond[] = $adapter->quoteInto('entity_id = ?', $newId);
$updateCond[] = $adapter->quoteInto('attribute_id = ?', $statusAttributeId);

$adapter->update(
$statusAttributeTable,
['value' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED],
Expand Down
Loading
Loading