Skip to content

Commit c43d763

Browse files
authored
Merge pull request #5813 from magento-engcom/banned-words-plus-asset-fields
[Magento Community Engineering] Forwardporting required changes from 2.4.0
2 parents 2abec27 + 09c3dd9 commit c43d763

File tree

44 files changed

+230
-157
lines changed

Some content is hidden

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

44 files changed

+230
-157
lines changed

app/code/Magento/Catalog/Model/FilterProductCustomAttribute.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
namespace Magento\Catalog\Model;
99

1010
/**
11-
* Filter custom attributes for product using the blacklist
11+
* Filter custom attributes for product using the excluded list
1212
*/
1313
class FilterProductCustomAttribute
1414
{
1515
/**
1616
* @var array
1717
*/
18-
private $blackList;
18+
private $excludedList;
1919

2020
/**
21-
* @param array $blackList
21+
* @param array $excludedList
2222
*/
23-
public function __construct(array $blackList = [])
23+
public function __construct(array $excludedList = [])
2424
{
25-
$this->blackList = $blackList;
25+
$this->excludedList = $excludedList;
2626
}
2727

2828
/**
@@ -33,6 +33,6 @@ public function __construct(array $blackList = [])
3333
*/
3434
public function execute(array $attributes): array
3535
{
36-
return array_diff_key($attributes, array_flip($this->blackList));
36+
return array_diff_key($attributes, array_flip($this->excludedList));
3737
}
3838
}

app/code/Magento/CatalogInventory/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</type>
3838
<type name="Magento\Catalog\Model\FilterProductCustomAttribute">
3939
<arguments>
40-
<argument name="blackList" xsi:type="array">
40+
<argument name="excludedList" xsi:type="array">
4141
<item name="quantity_and_stock_status" xsi:type="string">quantity_and_stock_status</item>
4242
</argument>
4343
</arguments>

app/code/Magento/Eav/Model/Validator/Attribute/Data.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class Data extends \Magento\Framework\Validator\AbstractValidator
2323
/**
2424
* @var array
2525
*/
26-
protected $_attributesWhiteList = [];
26+
protected $allowedAttributesList = [];
2727

2828
/**
2929
* @var array
3030
*/
31-
protected $_attributesBlackList = [];
31+
protected $deniedAttributesList = [];
3232

3333
/**
3434
* @var array
@@ -68,9 +68,9 @@ public function setAttributes(array $attributes)
6868
* @param array $attributesCodes
6969
* @return $this
7070
*/
71-
public function setAttributesWhiteList(array $attributesCodes)
71+
public function setAllowedAttributesList(array $attributesCodes)
7272
{
73-
$this->_attributesWhiteList = $attributesCodes;
73+
$this->allowedAttributesList = $attributesCodes;
7474
return $this;
7575
}
7676

@@ -82,9 +82,9 @@ public function setAttributesWhiteList(array $attributesCodes)
8282
* @param array $attributesCodes
8383
* @return $this
8484
*/
85-
public function setAttributesBlackList(array $attributesCodes)
85+
public function setDeniedAttributesList(array $attributesCodes)
8686
{
87-
$this->_attributesBlackList = $attributesCodes;
87+
$this->deniedAttributesList = $attributesCodes;
8888
return $this;
8989
}
9090

@@ -171,11 +171,11 @@ protected function _getAttributes($entity)
171171
$attributesCodes[] = $attributeCode;
172172
}
173173

174-
$ignoreAttributes = $this->_attributesBlackList;
175-
if ($this->_attributesWhiteList) {
174+
$ignoreAttributes = $this->deniedAttributesList;
175+
if ($this->allowedAttributesList) {
176176
$ignoreAttributes = array_merge(
177177
$ignoreAttributes,
178-
array_diff($attributesCodes, $this->_attributesWhiteList)
178+
array_diff($attributesCodes, $this->allowedAttributesList)
179179
);
180180
}
181181

app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/DataTest.php

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ public function testIsValidAttributesFromCollection()
249249
}
250250

251251
/**
252-
* @dataProvider whiteBlackListProvider
252+
* @dataProvider allowDenyListProvider
253253
* @param callable $callback
254254
*/
255-
public function testIsValidBlackListWhiteListChecks($callback)
255+
public function testIsValidExclusionInclusionListChecks($callback)
256256
{
257257
$attribute = $this->_getAttributeMock(
258258
[
@@ -302,19 +302,19 @@ public function testIsValidBlackListWhiteListChecks($callback)
302302
/**
303303
* @return array
304304
*/
305-
public function whiteBlackListProvider()
305+
public function allowDenyListProvider()
306306
{
307-
$whiteCallback = function ($validator) {
308-
$validator->setAttributesWhiteList(['attribute']);
307+
$allowedCallbackList = function ($validator) {
308+
$validator->setAllowedAttributesList(['attribute']);
309309
};
310310

311-
$blackCallback = function ($validator) {
312-
$validator->setAttributesBlackList(['attribute2']);
311+
$deniedCallbackList = function ($validator) {
312+
$validator->setDeniedAttributesList(['attribute2']);
313313
};
314-
return ['white_list' => [$whiteCallback], 'black_list' => [$blackCallback]];
314+
return ['allowed' => [$allowedCallbackList], 'denied' => [$deniedCallbackList]];
315315
}
316316

317-
public function testSetAttributesWhiteList()
317+
public function testSetAttributesAllowedList()
318318
{
319319
$this->markTestSkipped('Skipped in #27500 due to testing protected/private methods and properties');
320320

@@ -328,12 +328,14 @@ public function testSetAttributesWhiteList()
328328
)
329329
->getMock();
330330
$validator = new Data($attrDataFactory);
331-
$result = $validator->setAttributesWhiteList($attributes);
332-
$this->assertAttributeEquals($attributes, '_attributesWhiteList', $validator);
331+
$result = $validator->setIncludedAttributesList($attributes);
332+
333+
// phpstan:ignore
334+
$this->assertAttributeEquals($attributes, '_attributesAllowed', $validator);
333335
$this->assertEquals($validator, $result);
334336
}
335337

336-
public function testSetAttributesBlackList()
338+
public function testSetAttributesDeniedList()
337339
{
338340
$this->markTestSkipped('Skipped in #27500 due to testing protected/private methods and properties');
339341

@@ -347,8 +349,9 @@ public function testSetAttributesBlackList()
347349
)
348350
->getMock();
349351
$validator = new Data($attrDataFactory);
350-
$result = $validator->setAttributesBlackList($attributes);
351-
$this->assertAttributeEquals($attributes, '_attributesBlackList', $validator);
352+
$result = $validator->setDeniedAttributesList($attributes);
353+
// phpstan:ignore
354+
$this->assertAttributeEquals($attributes, '_attributesDenied', $validator);
352355
$this->assertEquals($validator, $result);
353356
}
354357

app/code/Magento/Elasticsearch/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@
537537
</type>
538538
<type name="Magento\Search\Model\SearchEngine\Validator">
539539
<arguments>
540-
<argument name="engineBlacklist" xsi:type="array">
540+
<argument name="excludedEngineList" xsi:type="array">
541541
<item name="elasticsearch" xsi:type="string">Elasticsearch 2</item>
542542
</argument>
543543
<argument name="engineValidators" xsi:type="array">

app/code/Magento/Fedex/etc/wsdl/RateService_v10.wsdl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@
472472
<xs:complexType name="Commodity">
473473
<xs:annotation>
474474
<xs:documentation>
475-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
475+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
476476
If this shipment contains more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
477477
</xs:documentation>
478478
</xs:annotation>
@@ -983,7 +983,7 @@
983983
</xs:element>
984984
<xs:element name="CustomsValue" type="ns:Money" minOccurs="0">
985985
<xs:annotation>
986-
<xs:documentation>The total customs value for the shipment. This total will rrepresent th esum of the values of all commodities, and may include freight, miscellaneous, and insurance charges. Must contain 2 explicit decimal positions with a max length of 17 including the decimal. For Express International MPS, the Total Customs Value is in the master transaction and all child transactions</xs:documentation>
986+
<xs:documentation>The total customs value for the shipment. This total will rrepresent th esum of the values of all commodities, and may include freight, miscellaneous, and insurance charges. Must contain 2 explicit decimal positions with a max length of 17 including the decimal. For Express International MPS, the Total Customs Value is in the main transaction and all child transactions</xs:documentation>
987987
</xs:annotation>
988988
</xs:element>
989989
<xs:element name="FreightOnValue" type="ns:FreightOnValueType" minOccurs="0">
@@ -1005,7 +1005,7 @@
10051005
<xs:element name="Commodities" type="ns:Commodity" minOccurs="0" maxOccurs="99">
10061006
<xs:annotation>
10071007
<xs:documentation>
1008-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
1008+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
10091009
If this shipment contains more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
10101010
</xs:documentation>
10111011
</xs:annotation>
@@ -4867,4 +4867,4 @@
48674867
<s1:address location="https://wsbeta.fedex.com:443/web-services/rate"/>
48684868
</port>
48694869
</service>
4870-
</definitions>
4870+
</definitions>

app/code/Magento/Fedex/etc/wsdl/RateService_v9.wsdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@
471471
<xs:complexType name="Commodity">
472472
<xs:annotation>
473473
<xs:documentation>
474-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
474+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
475475
If this shipment commitment more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
476476
</xs:documentation>
477477
</xs:annotation>
@@ -983,7 +983,7 @@
983983
</xs:element>
984984
<xs:element name="CustomsValue" type="ns:Money" minOccurs="0">
985985
<xs:annotation>
986-
<xs:documentation>The total customs value for the shipment. This total will rrepresent th esum of the values of all commodities, and may include freight, miscellaneous, and insurance charges. Must contain 2 explicit decimal positions with a max length of 17 including the decimal. For Express International MPS, the Total Customs Value is in the master transaction and all child transactions</xs:documentation>
986+
<xs:documentation>The total customs value for the shipment. This total will rrepresent th esum of the values of all commodities, and may include freight, miscellaneous, and insurance charges. Must contain 2 explicit decimal positions with a max length of 17 including the decimal. For Express International MPS, the Total Customs Value is in the main transaction and all child transactions</xs:documentation>
987987
</xs:annotation>
988988
</xs:element>
989989
<xs:element name="FreightOnValue" type="ns:FreightOnValueType" minOccurs="0">
@@ -1005,7 +1005,7 @@
10051005
<xs:element name="Commodities" type="ns:Commodity" minOccurs="0" maxOccurs="99">
10061006
<xs:annotation>
10071007
<xs:documentation>
1008-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
1008+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
10091009
If this shipment contains more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
10101010
</xs:documentation>
10111011
</xs:annotation>

app/code/Magento/Fedex/etc/wsdl/ShipService_v10.wsdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@
497497
<xs:complexType name="Commodity">
498498
<xs:annotation>
499499
<xs:documentation>
500-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
500+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
501501
If this shipment contains more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
502502
</xs:documentation>
503503
</xs:annotation>
@@ -724,7 +724,7 @@
724724
</xs:element>
725725
<xs:element name="MasterTrackingId" type="ns:TrackingId" minOccurs="0">
726726
<xs:annotation>
727-
<xs:documentation>The master tracking number and form id of this multiple piece shipment. This information is to be provided for each subsequent of a multiple piece shipment.</xs:documentation>
727+
<xs:documentation>The main tracking number and form id of this multiple piece shipment. This information is to be provided for each subsequent of a multiple piece shipment.</xs:documentation>
728728
</xs:annotation>
729729
</xs:element>
730730
<xs:element name="ServiceTypeDescription" type="xs:string" minOccurs="0">

app/code/Magento/Fedex/etc/wsdl/ShipService_v9.wsdl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@
497497
<xs:complexType name="Commodity">
498498
<xs:annotation>
499499
<xs:documentation>
500-
For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction.
500+
For international multiple piece shipments, commodity information must be passed in the Main and on each child transaction.
501501
If this shipment contains more than four commodity line items, the four highest valued should be included in the first 4 occurrences for this request.
502502
</xs:documentation>
503503
</xs:annotation>
@@ -724,7 +724,7 @@
724724
</xs:element>
725725
<xs:element name="MasterTrackingId" type="ns:TrackingId" minOccurs="0">
726726
<xs:annotation>
727-
<xs:documentation>The master tracking number and form id of this multiple piece shipment. This information is to be provided for each subsequent of a multiple piece shipment.</xs:documentation>
727+
<xs:documentation>The main tracking number and form id of this multiple piece shipment. This information is to be provided for each subsequent of a multiple piece shipment.</xs:documentation>
728728
</xs:annotation>
729729
</xs:element>
730730
<xs:element name="ServiceTypeDescription" type="xs:string" minOccurs="0">

app/code/Magento/ImportExport/Model/Import/AbstractEntity.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/**
1616
* Import entity abstract model
1717
*
18+
* phpcs:disable Magento2.Classes.AbstractApi
1819
* @api
1920
*
2021
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -335,6 +336,8 @@ public function __construct(
335336
}
336337

337338
/**
339+
* Returns Error aggregator
340+
*
338341
* @return ProcessingErrorAggregatorInterface
339342
*/
340343
public function getErrorAggregator()
@@ -413,7 +416,7 @@ protected function _saveValidatedBunches()
413416

414417
$source->rewind();
415418
$this->_dataSourceModel->cleanBunches();
416-
$masterAttributeCode = $this->getMasterAttributeCode();
419+
$mainAttributeCode = $this->getMasterAttributeCode();
417420

418421
while ($source->valid() || count($bunchRows) || isset($entityGroup)) {
419422
if ($startNewBunch || !$source->valid()) {
@@ -453,7 +456,7 @@ protected function _saveValidatedBunches()
453456
continue;
454457
}
455458

456-
if (isset($rowData[$masterAttributeCode]) && trim($rowData[$masterAttributeCode])) {
459+
if (isset($rowData[$mainAttributeCode]) && trim($rowData[$mainAttributeCode])) {
457460
/* Add entity group that passed validation to bunch */
458461
if (isset($entityGroup)) {
459462
foreach ($entityGroup as $key => $value) {
@@ -590,6 +593,7 @@ public function getBehavior(array $rowData = null)
590593
* Get default import behavior
591594
*
592595
* @return string
596+
* phpcs:disable Magento2.Functions.StaticFunction
593597
*/
594598
public static function getDefaultBehavior()
595599
{
@@ -652,7 +656,9 @@ public function isAttributeParticular($attributeCode)
652656
}
653657

654658
/**
655-
* @return string the master attribute code to use in an import
659+
* Returns the master attribute code to use in an import
660+
*
661+
* @return string
656662
*/
657663
public function getMasterAttributeCode()
658664
{

0 commit comments

Comments
 (0)