Skip to content

Commit 3d46f12

Browse files
author
Lars Roettig
committed
#20: Fix phpcs
1 parent e48193e commit 3d46f12

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Magento2/Sniffs/Performance/ForeachArrayMergeSniff.php

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use PHP_CodeSniffer\Files\File;
1010
use PHP_CodeSniffer\Sniffs\Sniff;
1111

12+
/**
13+
* Detects array_merge(...) is used in a loop and is a resources greedy construction.
14+
*/
1215
class ForeachArrayMergeSniff implements Sniff
1316
{
1417
/**

Magento2/Tests/Performance/ForeachArrayMergeUnitTest.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $options = [];
1616
$itemCount = count($configurationSources);
1717
for ($i = 0; $i <= $itemCount; $i++) {
1818
$source = $options[$itemCount];
19-
$options = array_merge($options, $source));
19+
$options = array_merge($options, $source);
2020
}
2121

2222
class SelectBuilder

Magento2/Tests/Performance/ForeachArrayMergeUnitTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
* Copyright © Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento2\Tests\Performance;
78

89
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
910

1011
/**
1112
* Class EmptyCheckUnitTest
1213
*/
13-
class ForeachArrayMergeUnitTest extends AbstractSniffUnitTest
14+
class ForeachArrayMergeUnitTest extends AbstractSniffUnitTest
1415
{
1516
/**
1617
* @inheritdoc
@@ -27,7 +28,8 @@ public function getWarningList()
2728
{
2829
return [
2930
11 => 1,
30-
19 => 1
31+
19 => 1,
32+
41 => 1
3133
];
3234
}
3335
}

0 commit comments

Comments
 (0)