Skip to content

Commit f93b914

Browse files
authored
Merge pull request #1755 from magento-eqp/MM-2551-EQP-Sniffs-To-Magento
[Kraken] Move EQP static tests to Magento core
2 parents 4067591 + 704f3d1 commit f93b914

File tree

63 files changed

+412
-69
lines changed

Some content is hidden

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

63 files changed

+412
-69
lines changed

app/code/Magento/Backend/Block/Widget/Tabs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function addTab($tabId, $tab)
164164
*/
165165
protected function _addTabByName($tab, $tabId)
166166
{
167-
if (strpos($tab, '\Block\\')) {
167+
if (strpos($tab, '\Block\\') !== false) {
168168
$this->_tabs[$tabId] = $this->getLayout()->createBlock($tab, $this->getNameInLayout() . '_tab_' . $tabId);
169169
} elseif ($this->getChildBlock($tab)) {
170170
$this->_tabs[$tabId] = $this->getChildBlock($tab);

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ protected function parseOption($values)
217217
$option = [];
218218
foreach ($values as $keyValue) {
219219
$keyValue = trim($keyValue);
220-
if ($pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR)) {
220+
$pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR);
221+
if ($pos !== false) {
221222
$key = substr($keyValue, 0, $pos);
222223
$value = substr($keyValue, $pos + 1);
223224
if ($key == 'type') {

app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function getOptionText($value)
6767
$value = '0';
6868
}
6969
$isMultiple = false;
70-
if (strpos($value, ',')) {
70+
if (strpos($value, ',') !== false) {
7171
$isMultiple = true;
7272
$value = explode(',', $value);
7373
}

app/code/Magento/Deploy/Service/Bundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private function hasMinVersion($filePath)
167167
}
168168

169169
$info = pathinfo($filePath);
170-
if (strpos($filePath, '.min.') === true) {
170+
if (strpos($filePath, '.min.') !== false) {
171171
$this->excludedCache[] = str_replace(".min.{$info['extension']}", ".{$info['extension']}", $filePath);
172172
} else {
173173
$pathToMinVersion = $info['dirname'] . '/' . $info['filename'] . '.min.' . $info['extension'];
@@ -216,7 +216,7 @@ private function isExcluded($filePath, $area, $theme)
216216
*/
217217
private function prepareExcludePath($path)
218218
{
219-
if (strpos($path, Repository::FILE_ID_SEPARATOR) > 0) {
219+
if (strpos($path, Repository::FILE_ID_SEPARATOR) !== false) {
220220
list($excludedModule, $excludedPath) = explode(Repository::FILE_ID_SEPARATOR, $path);
221221
if ($excludedModule == 'Lib') {
222222
return $excludedPath;

app/code/Magento/DownloadableImportExport/Model/Import/Product/Type/Downloadable.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,8 @@ protected function parseLinkOption(array $values)
777777
$option = [];
778778
foreach ($values as $keyValue) {
779779
$keyValue = trim($keyValue);
780-
if ($pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR)) {
780+
$pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR);
781+
if ($pos !== false) {
781782
$key = substr($keyValue, 0, $pos);
782783
$value = substr($keyValue, $pos + 1);
783784
if ($key == 'sample') {
@@ -810,7 +811,8 @@ protected function parseSampleOption($values)
810811
$option = [];
811812
foreach ($values as $keyValue) {
812813
$keyValue = trim($keyValue);
813-
if ($pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR)) {
814+
$pos = strpos($keyValue, self::PAIR_VALUE_SEPARATOR);
815+
if ($pos !== false) {
814816
$key = substr($keyValue, 0, $pos);
815817
$value = substr($keyValue, $pos + 1);
816818
if ($key == self::URL_OPTION_VALUE || $key == self::FILE_OPTION_VALUE) {

app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private function addEmptyOption(array $options)
145145
public function getOptionText($value)
146146
{
147147
$isMultiple = false;
148-
if (strpos($value, ',')) {
148+
if (strpos($value, ',') !== false) {
149149
$isMultiple = true;
150150
$value = explode(',', $value);
151151
}

app/code/Magento/Email/Model/AbstractTemplate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function loadDefault($templateId)
289289
/**
290290
* trim copyright message
291291
*/
292-
if (preg_match('/^<!--[\w\W]+?-->/m', $templateText, $matches) && strpos($matches[0], 'Copyright') > 0) {
292+
if (preg_match('/^<!--[\w\W]+?-->/m', $templateText, $matches) && strpos($matches[0], 'Copyright') !== false) {
293293
$templateText = str_replace($matches[0], '', $templateText);
294294
}
295295

app/code/Magento/Fedex/Setup/InstallData.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
8282
$mapsOld = $conn->fetchAll($select);
8383
foreach ($mapsOld as $mapOld) {
8484
$mapNew = '';
85-
if (stripos($mapOld['path'], 'packaging') && isset($codes['packaging'][$mapOld['value']])) {
85+
if (stripos($mapOld['path'], 'packaging') !== false && isset($codes['packaging'][$mapOld['value']])) {
8686
$mapNew = $codes['packaging'][$mapOld['value']];
87-
} elseif (stripos($mapOld['path'], 'dropoff') && isset($codes['dropoff'][$mapOld['value']])) {
87+
} elseif (stripos($mapOld['path'], 'dropoff') !== false && isset($codes['dropoff'][$mapOld['value']])) {
8888
$mapNew = $codes['dropoff'][$mapOld['value']];
89-
} elseif (stripos($mapOld['path'], 'free_method') && isset($codes['method'][$mapOld['value']])) {
89+
} elseif (stripos($mapOld['path'], 'free_method') !== false && isset($codes['method'][$mapOld['value']])) {
9090
$mapNew = $codes['method'][$mapOld['value']];
91-
} elseif (stripos($mapOld['path'], 'allowed_methods')) {
91+
} elseif (stripos($mapOld['path'], 'allowed_methods') !== false) {
9292
foreach (explode(',', $mapOld['value']) as $shippingMethod) {
9393
if (isset($codes['method'][$shippingMethod])) {
9494
$mapNew[] = $codes['method'][$shippingMethod];

app/code/Magento/Shipping/Test/Unit/Model/Carrier/AbstractCarrierOnlineTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public function testParseXmlXXEXml()
128128

129129
$xmlElement = $this->carrier->parseXml($xmlString);
130130

131+
// @codingStandardsIgnoreLine
131132
echo $xmlElement->asXML();
132133
}
133134

app/code/Magento/Usps/Setup/UpgradeData.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ private function updateAllowedMethods(ModuleDataSetupInterface $setup)
8888
$oldConfigValues = $connection->fetchAll($select);
8989

9090
foreach ($oldConfigValues as $oldValue) {
91-
if (stripos($oldValue['path'], 'free_method') && isset($oldToNewMethodCodesMap[$oldValue['value']])) {
91+
if (stripos($oldValue['path'], 'free_method') !== false
92+
&& isset($oldToNewMethodCodesMap[$oldValue['value']])
93+
) {
9294
$newValue = $oldToNewMethodCodesMap[$oldValue['value']];
93-
} elseif (stripos($oldValue['path'], 'allowed_methods')) {
95+
} elseif (stripos($oldValue['path'], 'allowed_methods') !== false) {
9496
$newValuesList = [];
9597
foreach (explode(',', $oldValue['value']) as $shippingMethod) {
9698
if (isset($oldToNewMethodCodesMap[$shippingMethod])) {

0 commit comments

Comments
 (0)