Skip to content

Commit

Permalink
Merge branch 'main' into fix-swatch-product-list-stock-status
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Sep 9, 2024
2 parents 59ffe84 + e75e940 commit 715fa52
Show file tree
Hide file tree
Showing 107 changed files with 289 additions and 216 deletions.
2 changes: 1 addition & 1 deletion .ddev/commands/web/magerun
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Example: "ddev magerun"

if [ ! -f vendor/bin/n98-magerun ]; then
read -r -p "n98-magerun is not installed. Do you want to install it? [y/N] " INSTALL_MAGE
read -r -p "n98-magerun is not installed. Do you want to install it? [y/N] " INSTALL_MAGERUN
INSTALL_MAGERUN=${INSTALL_MAGERUN,,} # to lower
if [[ "${INSTALL_MAGERUN}" =~ ^(yes|y) ]]; then
composer require --dev n98/magerun:dev-develop
Expand Down
Empty file modified .ddev/commands/web/openmage-admin
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
'phpstan':
- changed-files:
- any-glob-to-any-file: [
.phpstan*,
phpstan*,
.github/workflows/phpstan.yml
]
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ name: "CodeQL"

on:
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:
push:
branches: [ "main", "next", "v19" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main", "next", "v19" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.3']
php-versions: ['7.4', '8.4']

steps:
- name: Setup PHP
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/syntax-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php: ['7.4', '8.3']
php: ['7.4', '8.4']

name: PHP Syntax ${{ matrix.php }}

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@
.phpcs*.xml
!.phpcs*.xml.dist

# PhpStan
.phpstan*.neon
phpstan*.neon
!phpstan.dist.*.neon
!.phpstan.dist.neon
!.phpstan.dist.*.neon

# dev scripts loaded via composer
/shell/update-copyright.php
Expand Down
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
'class_definition' => true,
// Remove extra spaces in a nullable typehint.
'compact_nullable_typehint' => true,
// Concatenation should be spaced according to configuration.
'concat_space' => ['spacing' => 'one'],
// The PHP constants `true`, `false`, and `null` MUST be written using the correct casing.
'constant_case' => true,
// Equal sign in declare statement should be surrounded by spaces or not following configuration.
Expand Down Expand Up @@ -107,6 +109,7 @@
PhpCsFixer\Finder::create()
->in([
'app/code/core/Mage/',
'errors/',
'lib/Mage/',
'lib/Magento/',
'lib/Varien/',
Expand Down
5 changes: 5 additions & 0 deletions .phpcs.ecg.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<file>install.php</file>
<file>app/Mage.php</file>
<file>app/code/core/Mage/</file>
<file>errors/</file>
<file>lib/Mage/</file>
<file>lib/Magento/</file>
<file>lib/Varien/</file>
Expand Down Expand Up @@ -66,6 +67,7 @@
<exclude-pattern>*/core/Mage/Catalog/Model/Resource/Product/Compare/Item.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Catalog/Model/Resource/Product/Option/Value.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/CatalogIndex/Model/Indexer.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/CatalogInventory/Model/Observer.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php*</exclude-pattern>
Expand Down Expand Up @@ -111,6 +113,7 @@
<exclude-pattern>*/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Grouped.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/ImportExport/Model/Import/Proxy/Product/Resource.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Index/controllers/Adminhtml/ProcessController.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Index/Model/Observer.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Index/Model/Process.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Index/Model/Resource/Event.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Log/Model/Resource/Log.php*</exclude-pattern>
Expand Down Expand Up @@ -148,6 +151,7 @@
<exclude-pattern>*/core/Mage/Sales/Model/Order/Shipment.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/SalesRule/Model/Observer.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/SalesRule/Model/Rule.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/SalesRule/Model/Coupon/Massgenerator.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Tag/controllers/IndexController.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Tag/Model/Api.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/Tag/Model/Resource/Product/Collection.php*</exclude-pattern>
Expand All @@ -163,6 +167,7 @@
<exclude-pattern>*/lib/Varien/Cache/Backend/Memcached.php*</exclude-pattern>
<exclude-pattern>*/lib/Varien/Convert/Parser/Csv.php*</exclude-pattern>
<exclude-pattern>*/lib/Varien/Object/Cache.php*</exclude-pattern>
<exclude-pattern>*/shell/indexer.php*</exclude-pattern>
<exclude-pattern>*/core/Mage/*/data/*</exclude-pattern>
<exclude-pattern>*/core/Mage/*/sql/*</exclude-pattern>
</rule>
Expand Down
1 change: 1 addition & 0 deletions .phpcs.php.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<file>install.php</file>
<file>app/Mage.php</file>
<file>app/code/core/Mage/</file>
<file>errors/</file>
<file>lib/Mage/</file>
<file>lib/Magento/</file>
<file>lib/Varien/</file>
Expand Down
1 change: 1 addition & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<file>install.php</file>
<file>app/Mage.php</file>
<file>app/code/core/Mage/</file>
<file>errors/</file>
<file>lib/Mage/</file>
<file>lib/Magento/</file>
<file>lib/Varien/</file>
Expand Down
10 changes: 5 additions & 5 deletions phpstan.dist.baseline.neon → .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3290,11 +3290,6 @@ parameters:
count: 1
path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php

-
message: "#^Offset int\\|string on non\\-empty\\-array\\<int\\|string, non\\-empty\\-array\\> in isset\\(\\) always exists and is not nullable\\.$#"
count: 2
path: app/code/core/Mage/ImportExport/Model/Export/Entity/Product.php

-
message: "#^Variable \\$collection might not be defined\\.$#"
count: 1
Expand Down Expand Up @@ -3965,6 +3960,11 @@ parameters:
count: 1
path: app/code/core/Mage/Sales/Model/Entity/Quote/Address/Attribute/Frontend/Tax.php

-
message: "#^Negated boolean expression is always true\\.$#"
count: 1
path: app/code/core/Mage/Sales/Model/Order.php

-
message: "#^Variable \\$oldArea might not be defined\\.$#"
count: 1
Expand Down
3 changes: 2 additions & 1 deletion phpstan.dist.neon → .phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
includes:
- vendor/macopedia/phpstan-magento1/extension.neon
- phpstan.dist.baseline.neon
- .phpstan.dist.baseline.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
parameters:
magentoRootPath: %currentWorkingDirectory%
Expand All @@ -12,6 +12,7 @@ parameters:
- install.php
- app/Mage.php
- app/code/core/Mage
- errors
- lib/Mage
- lib/Magento
- lib/Varien
Expand Down
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public static function getStoreConfigAsInt(string $path, $store = null): int
* Retrieve config flag for store by path
*
* @param string $path
* @param mixed $store
* @param null|string|bool|int|Mage_Core_Model_Store $store
* @return bool
*/
public static function getStoreConfigFlag($path, $store = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function _prepareForm()

$fieldset->addField('req_text', 'note', [
'text' => '<ul class="messages"><li class="notice-msg"><ul><li>'
. $this->__('Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available.')
. $this->__('Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available.')
. '</li></ul></li></ul>'
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function initForm()
$form->getElement('website_id')->setAfterElementHtml(
'<script type="text/javascript">'
. "
var {$prefix}_websites = " . Mage::helper('core')->jsonEncode($websites) .";
var {$prefix}_websites = " . Mage::helper('core')->jsonEncode($websites) . ";
Validation.add(
'validate-website-has-store',
'" . Mage::helper('core')->jsQuoteEscape(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function _prepareLayout()
'name' => 'add_address_button',
'element_name' => 'add_address_button',
'disabled' => $this->isReadonly(),
'class' => 'add' . ($this->isReadonly() ? ' disabled' : ''),
'class' => 'add' . ($this->isReadonly() ? ' disabled' : ''),
'onclick' => 'customerAddresses.addNewAddress()'
])
);
Expand All @@ -75,7 +75,7 @@ protected function _prepareLayout()
'id' => 'cancel_add_address' . $this->getTemplatePrefix(),
'name' => 'cancel_address',
'element_name' => 'cancel_address',
'class' => 'cancel delete-address' . ($this->isReadonly() ? ' disabled' : ''),
'class' => 'cancel delete-address' . ($this->isReadonly() ? ' disabled' : ''),
'disabled' => $this->isReadonly(),
'onclick' => 'customerAddresses.cancelAdd(this)',
])
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function getChartUrl($directUrl = true)
$dateStart->addMonth(1);
break;
}
foreach ($this->getAllSeries() as $index => $serie) {
foreach (array_keys($this->getAllSeries()) as $index) {
if (in_array($d, $this->_axisLabels['x'])) {
$datas[$index][] = (float)array_shift($this->_allSeries[$index]);
} else {
Expand Down Expand Up @@ -328,7 +328,7 @@ public function getChartUrl($directUrl = true)
if (count($this->_axisLabels)) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
$indexid = 0;
foreach ($this->_axisLabels as $idx => $labels) {
foreach (array_keys($this->_axisLabels) as $idx) {
if ($idx === 'x') {
/**
* Format date
Expand Down
6 changes: 2 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/Page/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,8 @@ protected function _buildMenuArray(Varien_Simplexml_Element $parent, $path = '',

uasort($parentArr, [$this, '_sortMenu']);

foreach ($parentArr as $key => $value) {
$last = $key;
}
if (isset($last)) {
$last = array_key_last($parentArr);
if (!is_null($last)) {
$parentArr[$last]['last'] = true;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Report/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected function _prepareCollection()
*/
protected function _setFilterValues($data)
{
foreach ($data as $name => $value) {
foreach (array_keys($data) as $name) {
$this->setFilter($name, $data[$name]);
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public function canSendCommentEmail()
/**
* Replace links in string
*
* @param array|string $data
* @param null|array $allowedTags
* @return string
* @param string|string[] $data
* @param array|null $allowedTags
* @return null|string|string[]
*/
public function escapeHtml($data, $allowedTags = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public function isCustomerNotificationNotApplicable(Mage_Sales_Model_Order_Statu
/**
* Replace links in string
*
* @param array|string $data
* @param null|array $allowedTags
* @return string
* @param string|string[] $data
* @param array|null $allowedTags
* @return null|string|string[]
*/
public function escapeHtml($data, $allowedTags = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function _prepareColumns()
{
$result = parent::_prepareColumns();

foreach ($this->_columns as $key => $value) {
foreach (array_keys($this->_columns) as $key) {
if (in_array($key, $this->_columnsToRemove)) {
unset($this->_columns[$key]);
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Adminhtml/Block/Store/Switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getWebsites()
{
$websites = Mage::app()->getWebsites();
if ($websiteIds = $this->getWebsiteIds()) {
foreach ($websites as $websiteId => $website) {
foreach (array_keys($websites) as $websiteId) {
if (!in_array($websiteId, $websiteIds)) {
unset($websites[$websiteId]);
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public function getStores($group)
}
$stores = $group->getStores();
if ($storeIds = $this->getStoreIds()) {
foreach ($stores as $storeId => $store) {
foreach (array_keys($stores) as $storeId) {
if (!in_array($storeId, $storeIds)) {
unset($stores[$storeId]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Urlrewrite/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function getButtonsHtml($area = null)
{
if ($this->_buttonsHtml === null) {
$this->_buttonsHtml = parent::getButtonsHtml();
foreach ($this->_children as $alias => $child) {
foreach (array_keys($this->_children) as $alias) {
if (str_contains($alias, '_button')) {
$this->unsetChild($alias);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function _prepareForm()
'description' => $model->getDescription(),
];
if ($sessionData = Mage::getSingleton('adminhtml/session')->getData('urlrewrite_data', true)) {
foreach ($formValues as $key => $value) {
foreach (array_keys($formValues) as $key) {
if (isset($sessionData[$key])) {
$formValues[$key] = $sessionData[$key];
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public function getColumns()
*/
protected function _setFilterValues($data)
{
foreach ($data as $columnId => $value) {
foreach (array_keys($data) as $columnId) {
$column = $this->getColumn($columnId);
if ($column instanceof Mage_Adminhtml_Block_Widget_Grid_Column
&& (!empty($data[$columnId]) || strlen($data[$columnId]) > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function _toLinkHtml($action, Varien_Object $row)
*/
protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
{
foreach ($action as $attribute => $value) {
foreach (array_keys($action) as $attribute) {
if (isset($action[$attribute]) && !is_array($action[$attribute])) {
$this->getColumn()->setFormat($action[$attribute]);
$action[$attribute] = parent::render($row);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ protected function _reorderTabs()
asort($this->_tabPositions);

$ordered = [];
foreach ($this->_tabPositions as $tabId => $position) {
foreach (array_keys($this->_tabPositions) as $tabId) {
if (isset($this->_tabs[$tabId])) {
$tab = $this->_tabs[$tabId];
$ordered[$tabId] = $tab;
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Adminhtml/Helper/Sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ public function applySalableProductTypesFilter($collection)
/**
* Escape string preserving links
*
* @param array|string $data
* @param null|array $allowedTags
* @return string
* @param string|string[] $data
* @param array|null $allowedTags
* @return null|string|string[]
*/
public function escapeHtmlWithLinks($data, $allowedTags = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ protected function _buildMenuArray(?Varien_Simplexml_Element $parent = null, $pa

uasort($parentArr, [$this, '_sortMenu']);

foreach ($parentArr as $key => $value) {
$last = $key;
}
if (isset($last)) {
$last = array_key_last($parentArr);
if (!is_null($last)) {
$parentArr[$last]['last'] = true;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api2/Model/Acl/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(Mage_Api2_Model_Resource $resource)
*/
protected function _filter(array $allowedAttributes, array $data)
{
foreach ($data as $attribute => $value) {
foreach (array_keys($data) as $attribute) {
if (!in_array($attribute, $allowedAttributes)) {
unset($data[$attribute]);
}
Expand Down
Loading

0 comments on commit 715fa52

Please sign in to comment.