Skip to content

Commit 00ae524

Browse files
ACPT-490
fixing static test failures
1 parent 01140b8 commit 00ae524

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -299,19 +299,19 @@ protected function _initAttributes()
299299
}
300300
}
301301
$addedAttributes = [];
302-
foreach ($absentKeys as $attributeSetName => $attributeIds) {
302+
foreach ($absentKeys as $attributeIds) {
303303
$unknownAttributeIds = array_diff(
304304
$attributeIds,
305305
array_keys(self::$commonAttributesCache),
306306
self::$invAttributesCache
307307
);
308308
if ($unknownAttributeIds) {
309-
$addedAttributes[] = $this->attachAttributesByOnlyId($attributeSetName, $unknownAttributeIds);
310-
}
311-
if ($this->_forcedAttributesCodes) {
312-
$addedAttributes[] = $this->attachAttributesByForcedCodes($attributeSetName);
309+
$addedAttributes[] = $this->attachAttributesByOnlyId($unknownAttributeIds);
313310
}
314311
}
312+
if ($this->_forcedAttributesCodes) {
313+
$addedAttributes[] = $this->attachAttributesByForcedCodes();
314+
}
315315
$addedAttributes = array_merge(...$addedAttributes);
316316
$attributesToLoadFromTable = [];
317317
foreach ($addedAttributes as $addedAttribute) {
@@ -361,8 +361,9 @@ protected function _initAttributes()
361361
* @param string $attributeSetName
362362
* @param array $attributeIds
363363
* @return void
364-
* @deprecated use attachAttributesOnlyById and attachAttributesByForcedCodes
365-
* @see attachAttributesOnlyById() and attachAttributesByForcedCodes()
364+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
365+
* @deprecated use attachAttributesByOnlyId and attachAttributesByForcedCodes
366+
* @see attachAttributesByOnlyId() and attachAttributesByForcedCodes()
366367
*/
367368
protected function attachAttributesById($attributeSetName, $attributeIds)
368369
{
@@ -373,25 +374,24 @@ protected function attachAttributesById($attributeSetName, $attributeIds)
373374
['in' => $this->_forcedAttributesCodes]
374375
]
375376
) as $attribute) {
376-
$this->attachAttribute($attributeSetName, $attribute);
377+
$this->attachAttribute($attribute);
377378
}
378379
}
379380

380381
/**
381382
* Attach Attributes By Id
382383
*
383-
* @param string $attributeSetName
384384
* @param array $attributeIds
385385
* @return array
386386
*/
387-
private function attachAttributesByOnlyId(string $attributeSetName, array $attributeIds) : array
387+
private function attachAttributesByOnlyId(array $attributeIds) : array
388388
{
389389
$addedAttributes = [];
390390
foreach ($this->_prodAttrColFac->create()->addFieldToFilter(
391391
['main_table.attribute_id', 'main_table.attribute_code'],
392392
[['in' => $attributeIds]]
393393
) as $attribute) {
394-
$cachedAttribute = $this->attachAttribute($attributeSetName, $attribute);
394+
$cachedAttribute = $this->attachAttribute($attribute);
395395
if (null !== $cachedAttribute) {
396396
$addedAttributes[] = $cachedAttribute;
397397
}
@@ -402,17 +402,16 @@ private function attachAttributesByOnlyId(string $attributeSetName, array $attri
402402
/**
403403
* Attach Attributes By _forcedAttributesCodes
404404
*
405-
* @param string $attributeSetName
406405
* @return array
407406
*/
408-
private function attachAttributesByForcedCodes(string $attributeSetName) : array
407+
private function attachAttributesByForcedCodes() : array
409408
{
410409
$addedAttributes = [];
411410
foreach ($this->_prodAttrColFac->create()->addFieldToFilter(
412411
['main_table.attribute_code'],
413412
[['in' => $this->_forcedAttributesCodes]]
414413
) as $attribute) {
415-
$cachedAttribute = $this->attachAttribute($attributeSetName, $attribute);
414+
$cachedAttribute = $this->attachAttribute($attribute);
416415
if (null !== $cachedAttribute) {
417416
$addedAttributes[] = $cachedAttribute;
418417
}
@@ -423,11 +422,10 @@ private function attachAttributesByForcedCodes(string $attributeSetName) : array
423422
/**
424423
* Attach Attribute to self::$commonAttributesCache or self::$invAttributesCache
425424
*
426-
* @param string $attributeSetName
427425
* @param ProductAttributeInterface $attribute
428426
* @return array|null
429427
*/
430-
private function attachAttribute(string $attributeSetName, ProductAttributeInterface $attribute)
428+
private function attachAttribute(ProductAttributeInterface $attribute)
431429
{
432430
$cachedAttribute = null;
433431
$attributeCode = $attribute->getAttributeCode();

0 commit comments

Comments
 (0)