Skip to content

Commit 9e1caf9

Browse files
author
Stanislav Idolov
committed
Minor code style fixes
1 parent 8e85a85 commit 9e1caf9

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,18 +514,14 @@ protected function processMediaGallery(ProductInterface $product, $mediaGalleryE
514514
$newEntries = $mediaGalleryEntries;
515515
}
516516

517-
$images = $product->getMediaGallery('images');
518-
if ($images) {
519-
$images = $this->determineImageRoles($product, $images);
520-
}
517+
$images = (array)$product->getMediaGallery('images');
518+
$images = $this->determineImageRoles($product, $images);
521519

522520
$this->getMediaGalleryProcessor()->clearMediaAttribute($product, array_keys($product->getMediaAttributes()));
523521

524-
if ($images) {
525-
foreach ($images as $image) {
526-
if (!isset($image['removed']) && !empty($image['types'])) {
527-
$this->getMediaGalleryProcessor()->setMediaAttribute($product, $image['types'], $image['file']);
528-
}
522+
foreach ($images as $image) {
523+
if (!isset($image['removed']) && !empty($image['types'])) {
524+
$this->getMediaGalleryProcessor()->setMediaAttribute($product, $image['types'], $image['file']);
529525
}
530526
}
531527

@@ -770,7 +766,7 @@ public function cleanCache()
770766
* @param array $images
771767
* @return array
772768
*/
773-
private function determineImageRoles(ProductInterface $product, array $images)
769+
private function determineImageRoles(ProductInterface $product, array $images) : array
774770
{
775771
$imagesWithRoles = [];
776772
foreach ($images as $image) {

app/code/Magento/Catalog/Test/Unit/Cron/DeleteOutdatedPriceValuesTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ public function testExecute()
9898
$this->attributeMock->expects($this->once())->method('getId')->willReturn($attributeId);
9999
$this->attributeMock->expects($this->once())->method('getBackend')->willReturn($this->attributeBackendMock);
100100
$this->attributeBackendMock->expects($this->once())->method('getTable')->willReturn($table);
101-
$this->resourceConnectionMock->expects($this->once())->method('getConnection')->willReturn($this->dbAdapterMock);
101+
$this->resourceConnectionMock->expects($this->once())
102+
->method('getConnection')
103+
->willReturn($this->dbAdapterMock);
102104
$this->dbAdapterMock->expects($this->exactly(2))->method('quoteInto')->willReturnMap([
103105
['attribute_id = ?', $attributeId, null, null, $conditions[0]],
104106
['store_id != ?', Store::DEFAULT_STORE_ID, null, null, $conditions[1]],

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ define([
862862
this.update = true;
863863

864864
if (~~this.currentPage() === this.pages()) {
865-
lastRecordIndex = (this.startIndex + this.getChildItems().length - 1);
865+
lastRecordIndex = this.startIndex + this.getChildItems().length - 1;
866866
lastRecord =
867867
_.findWhere(this.elems(), {
868868
index: lastRecordIndex

0 commit comments

Comments
 (0)