Skip to content

Commit 915dfef

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #17291: fix: remove unused ID (by @DanielRuf) - #17191: [Backport 2.2]Filter test result collection with the cron job code defined in the c� (by @gelanivishal) - #16788: Replace sort callbacks to spaceship operator (by @lbajsarowicz) - #17275: fix #17193 Error with translation of confirmation modal buttons (by @Karlasa) - #17103: Code cleanup of lib files (by @mage2pratik) Fixed GitHub Issues: - #16243: Integration test ProcessCronQueueObserverTest.php succeeds regardless of magento config fixture (reported by @evktalo) has been fixed in #17191 by @gelanivishal in 2.2-develop branch Related commits: 1. ce5ac6e - #17193: Error with translation of confirmation modal buttons (reported by @delyriand) has been fixed in #17275 by @Karlasa in 2.2-develop branch Related commits: 1. 5cfde8a
2 parents 6f162dd + c130d01 commit 915dfef

File tree

57 files changed

+82
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+82
-124
lines changed

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,7 @@ public function attributesCompare($attributeOne, $attributeTwo)
291291
$sortOne = $attributeOne->getGroupSortPath() * 1000 + $attributeOne->getSortPath() * 0.0001;
292292
$sortTwo = $attributeTwo->getGroupSortPath() * 1000 + $attributeTwo->getSortPath() * 0.0001;
293293

294-
if ($sortOne > $sortTwo) {
295-
return 1;
296-
} elseif ($sortOne < $sortTwo) {
297-
return -1;
298-
}
299-
300-
return 0;
294+
return $sortOne <=> $sortTwo;
301295
}
302296

303297
/**

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<element name="isPaymentSection" type="text" selector="//*[@class='opc-progress-bar']/li[contains(@class, '_active') and span[contains(.,'Review &amp; Payments')]]"/>
1313
<element name="availablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div:nth-child(2)>div.payment-method-title.field.choice"/>
1414
<element name="notAvailablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div.payment-method._active>div.payment-method-title.field.choice"/>
15-
<element name="billingNewAddressForm" type="text" selector=".billing-new-address-form"/>
15+
<element name="billingNewAddressForm" type="text" selector="[data-form='billing-new-address']"/>
1616
<element name="placeOrderDisabled" type="button" selector="#checkout-payment-method-load button.disabled"/>
1717
<element name="update" type="button" selector=".payment-method-billing-address .action.action-update"/>
1818
<element name="guestFirstName" type="input" selector=".billing-address-form input[name*='firstname']"/>

app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
<!-- ko template: getTemplate() --><!-- /ko -->
1010
<!--/ko-->
1111
<form data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
12-
<fieldset
13-
data-bind="attr: { id:'billing-new-address-form-'+index, value:index}"
14-
class="billing-new-address-form fieldset address">
12+
<fieldset class="fieldset address" data-form="billing-new-address">
1513
<!-- ko foreach: getRegion('additional-fieldsets') -->
1614
<!-- ko template: getTemplate() --><!-- /ko -->
1715
<!--/ko-->

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,7 @@ public function attributesCompare($firstAttribute, $secondAttribute)
602602
$firstSort = $firstAttribute->getSortWeight((int) $this->_sortingSetId);
603603
$secondSort = $secondAttribute->getSortWeight((int) $this->_sortingSetId);
604604

605-
if ($firstSort > $secondSort) {
606-
return 1;
607-
} elseif ($firstSort < $secondSort) {
608-
return -1;
609-
}
610-
611-
return 0;
605+
return $firstSort <=> $secondSort;
612606
}
613607

614608
/**

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,7 @@ public function getGroupedAllShippingRates()
872872
*/
873873
protected function _sortRates($firstItem, $secondItem)
874874
{
875-
if ((int)$firstItem[0]->carrier_sort_order < (int)$secondItem[0]->carrier_sort_order) {
876-
return -1;
877-
} elseif ((int)$firstItem[0]->carrier_sort_order > (int)$secondItem[0]->carrier_sort_order) {
878-
return 1;
879-
} else {
880-
return 0;
881-
}
875+
return (int) $firstItem[0]->carrier_sort_order <=> (int) $secondItem[0]->carrier_sort_order;
882876
}
883877

884878
/**

app/code/Magento/Sales/Model/Config/Ordered.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,8 @@ function ($a, $b) {
167167
if (!isset($a['sort_order']) || !isset($b['sort_order'])) {
168168
return 0;
169169
}
170-
if ($a['sort_order'] > $b['sort_order']) {
171-
return 1;
172-
} elseif ($a['sort_order'] < $b['sort_order']) {
173-
return -1;
174-
} else {
175-
return 0;
176-
}
170+
171+
return $a['sort_order'] <=> $b['sort_order'];
177172
}
178173
);
179174
}

app/code/Magento/Ui/view/base/web/js/modal/confirm.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
define([
1010
'jquery',
1111
'underscore',
12+
'mage/translate',
1213
'jquery/ui',
13-
'Magento_Ui/js/modal/modal',
14-
'mage/translate'
15-
], function ($, _) {
14+
'Magento_Ui/js/modal/modal'
15+
], function ($, _, $t) {
1616
'use strict';
1717

1818
$.widget('mage.confirm', $.mage.modal, {
@@ -38,7 +38,7 @@ define([
3838
cancel: function () {}
3939
},
4040
buttons: [{
41-
text: $.mage.__('Cancel'),
41+
text: $t('Cancel'),
4242
class: 'action-secondary action-dismiss',
4343

4444
/**
@@ -48,7 +48,7 @@ define([
4848
this.closeModal(event);
4949
}
5050
}, {
51-
text: $.mage.__('OK'),
51+
text: $t('OK'),
5252
class: 'action-primary action-accept',
5353

5454
/**

dev/tests/integration/testsuite/Magento/Cron/Observer/ProcessCronQueueObserverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ protected function setUp()
2727
}
2828

2929
/**
30-
* @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr 8 * * * *
30+
* @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr * * * * *
3131
*/
3232
public function testDispatchScheduled()
3333
{
3434
$collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
3535
\Magento\Cron\Model\ResourceModel\Schedule\Collection::class
3636
);
3737
$collection->addFieldToFilter('status', \Magento\Cron\Model\Schedule::STATUS_PENDING);
38+
$collection->addFieldToFilter('job_code', 'catalog_product_alert');
3839
$this->assertGreaterThan(0, $collection->count(), 'Cron has failed to schedule tasks for itself for future.');
3940
}
4041

lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getCustomAttribute($attributeCode)
7474
*/
7575
public function getCustomAttributes()
7676
{
77-
return isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : [];
77+
return $this->_data[self::CUSTOM_ATTRIBUTES] ?? [];
7878
}
7979

8080
/**
@@ -129,7 +129,7 @@ public function setCustomAttribute($attributeCode, $attributeValue)
129129
*/
130130
protected function getCustomAttributesCodes()
131131
{
132-
return isset($this->customAttributesCodes) ? $this->customAttributesCodes : [];
132+
return $this->customAttributesCodes ?? [];
133133
}
134134

135135
/**

lib/internal/Magento/Framework/Api/AbstractSimpleObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(array $data = [])
3434
*/
3535
protected function _get($key)
3636
{
37-
return isset($this->_data[$key]) ? $this->_data[$key] : null;
37+
return $this->_data[$key] ?? null;
3838
}
3939

4040
/**

lib/internal/Magento/Framework/Api/ImageProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function processImageContent($entityType, $imageContent)
172172
*/
173173
protected function getMimeTypeExtension($mimeType)
174174
{
175-
return isset($this->mimeTypeExtensionMap[$mimeType]) ? $this->mimeTypeExtensionMap[$mimeType] : '';
175+
return $this->mimeTypeExtensionMap[$mimeType] ?? '';
176176
}
177177

178178
/**

lib/internal/Magento/Framework/Api/Search/Document.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function setId($id)
3333
*/
3434
public function getCustomAttribute($attributeCode)
3535
{
36-
return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
37-
? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
38-
: null;
36+
return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null;
3937
}
4038

4139
/**

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ private function getCustomFilterForField($field)
114114
*/
115115
private function getFieldMapping($field)
116116
{
117-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
117+
return $this->fieldMapping[$field] ?? $field;
118118
}
119119
}

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ private function getCustomJoin($field)
121121
*/
122122
private function getFieldMapping($field)
123123
{
124-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
124+
return $this->fieldMapping[$field] ?? $field;
125125
}
126126
}

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $col
5959
*/
6060
private function getFieldMapping($field)
6161
{
62-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
62+
return $this->fieldMapping[$field] ?? $field;
6363
}
6464

6565
/**

lib/internal/Magento/Framework/App/ActionFlag.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ public function get($action, $flag = '')
6565
$action = $this->_request->getActionName();
6666
}
6767
if ('' === $flag) {
68-
return isset(
69-
$this->_flags[$this->_getControllerKey()]
70-
) ? $this->_flags[$this->_getControllerKey()] : [];
68+
return $this->_flags[$this->_getControllerKey()] ?? [];
7169
} elseif (isset($this->_flags[$this->_getControllerKey()][$action][$flag])) {
7270
return $this->_flags[$this->_getControllerKey()][$action][$flag];
7371
} else {

lib/internal/Magento/Framework/App/AreaList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getCodeByFrontName($frontName)
8888
*/
8989
public function getFrontName($areaCode)
9090
{
91-
return isset($this->_areas[$areaCode]['frontName']) ? $this->_areas[$areaCode]['frontName'] : null;
91+
return $this->_areas[$areaCode]['frontName'] ?? null;
9292
}
9393

9494
/**
@@ -111,7 +111,7 @@ public function getCodes()
111111
*/
112112
public function getDefaultRouter($areaCode)
113113
{
114-
return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null;
114+
return $this->_areas[$areaCode]['router'] ?? null;
115115
}
116116

117117
/**

lib/internal/Magento/Framework/App/Config/Initial.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function getData($scope)
7272
list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null);
7373

7474
if (ScopeConfigInterface::SCOPE_TYPE_DEFAULT == $scopeType) {
75-
return isset($this->_data[$scopeType]) ? $this->_data[$scopeType] : [];
75+
return $this->_data[$scopeType] ?? [];
7676
} elseif ($scopeCode) {
77-
return isset($this->_data[$scopeType][$scopeCode]) ? $this->_data[$scopeType][$scopeCode] : [];
77+
return $this->_data[$scopeType][$scopeCode] ?? [];
7878
}
7979
return [];
8080
}

lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public function __construct(array $parts)
3232
*/
3333
public function getPart($code)
3434
{
35-
return isset($this->_parts[$code]) ? $this->_parts[$code] : null;
35+
return $this->_parts[$code] ?? null;
3636
}
3737
}

lib/internal/Magento/Framework/App/DeploymentConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function get($key = null, $defaultValue = null)
7070
if ($key === null) {
7171
return $this->flatData;
7272
}
73-
return isset($this->flatData[$key]) ? $this->flatData[$key] : $defaultValue;
73+
return $this->flatData[$key] ?? $defaultValue;
7474
}
7575

7676
/**

lib/internal/Magento/Framework/App/Http/Context.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ public function unsValue($name)
8484
*/
8585
public function getValue($name)
8686
{
87-
return isset($this->data[$name])
88-
? $this->data[$name]
89-
: (isset($this->default[$name]) ? $this->default[$name] : null);
87+
return $this->data[$name] ?? ($this->default[$name] ?? null);
9088
}
9189

9290
/**

lib/internal/Magento/Framework/Component/ComponentRegistrar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getPaths($type)
6868
public function getPath($type, $componentName)
6969
{
7070
self::validateType($type);
71-
return isset(self::$paths[$type][$componentName]) ? self::$paths[$type][$componentName] : null;
71+
return self::$paths[$type][$componentName] ?? null;
7272
}
7373

7474
/**

lib/internal/Magento/Framework/Config/View.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(
7171
public function getVars($module)
7272
{
7373
$this->initData();
74-
return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : [];
74+
return $this->data['vars'][$module] ?? [];
7575
}
7676

7777
/**
@@ -110,7 +110,7 @@ public function getVarValue($module, $var)
110110
public function getMediaEntities($module, $mediaType)
111111
{
112112
$this->initData();
113-
return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : [];
113+
return $this->data['media'][$module][$mediaType] ?? [];
114114
}
115115

116116
/**
@@ -124,9 +124,7 @@ public function getMediaEntities($module, $mediaType)
124124
public function getMediaAttributes($module, $mediaType, $mediaId)
125125
{
126126
$this->initData();
127-
return isset($this->data['media'][$module][$mediaType][$mediaId])
128-
? $this->data['media'][$module][$mediaType][$mediaId]
129-
: [];
127+
return $this->data['media'][$module][$mediaType][$mediaId] ?? [];
130128
}
131129

132130
/**
@@ -163,7 +161,7 @@ protected function getIdAttributes()
163161
public function getExcludedFiles()
164162
{
165163
$items = $this->getItems();
166-
return isset($items['file']) ? $items['file'] : [];
164+
return $items['file'] ?? [];
167165
}
168166

169167
/**
@@ -174,7 +172,7 @@ public function getExcludedFiles()
174172
public function getExcludedDir()
175173
{
176174
$items = $this->getItems();
177-
return isset($items['directory']) ? $items['directory'] : [];
175+
return $items['directory'] ?? [];
178176
}
179177

180178
/**
@@ -185,7 +183,7 @@ public function getExcludedDir()
185183
protected function getItems()
186184
{
187185
$this->initData();
188-
return isset($this->data['exclude']) ? $this->data['exclude'] : [];
186+
return $this->data['exclude'] ?? [];
189187
}
190188

191189
/**

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public function rawFetchRow($sql, $field = null)
483483
if (empty($field)) {
484484
return $row;
485485
} else {
486-
return isset($row[$field]) ? $row[$field] : false;
486+
return $row[$field] ?? false;
487487
}
488488
}
489489

lib/internal/Magento/Framework/Data/AbstractCriteria.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public function getLimit()
274274
*/
275275
public function getPart($name, $default = null)
276276
{
277-
return isset($this->data[$name]) ? $this->data[$name] : $default;
277+
return $this->data[$name] ?? $default;
278278
}
279279

280280
/**

lib/internal/Magento/Framework/Data/AbstractDataObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public function toArray()
5050
*/
5151
protected function get($key)
5252
{
53-
return isset($this->data[$key]) ? $this->data[$key] : null;
53+
return $this->data[$key] ?? null;
5454
}
5555
}

lib/internal/Magento/Framework/Data/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ public function count()
851851
*/
852852
public function getFlag($flag)
853853
{
854-
return isset($this->_flags[$flag]) ? $this->_flags[$flag] : null;
854+
return $this->_flags[$flag] ?? null;
855855
}
856856

857857
/**

lib/internal/Magento/Framework/Data/Structure.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function createElement($elementId, array $data)
166166
*/
167167
public function getElement($elementId)
168168
{
169-
return isset($this->_elements[$elementId]) ? $this->_elements[$elementId] : false;
169+
return $this->_elements[$elementId] ?? false;
170170
}
171171

172172
/**
@@ -456,9 +456,7 @@ public function getChildId($parentId, $alias)
456456
*/
457457
public function getChildren($parentId)
458458
{
459-
return isset(
460-
$this->_elements[$parentId][self::CHILDREN]
461-
) ? $this->_elements[$parentId][self::CHILDREN] : [];
459+
return $this->_elements[$parentId][self::CHILDREN] ?? [];
462460
}
463461

464462
/**
@@ -469,7 +467,7 @@ public function getChildren($parentId)
469467
*/
470468
public function getParentId($childId)
471469
{
472-
return isset($this->_elements[$childId][self::PARENT]) ? $this->_elements[$childId][self::PARENT] : false;
470+
return $this->_elements[$childId][self::PARENT] ?? false;
473471
}
474472

475473
/**

0 commit comments

Comments
 (0)