Skip to content

Commit 5481d43

Browse files
committed
code review improvements
1 parent 0bf7b7f commit 5481d43

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,9 @@ private function getPluginBlacklist(): array
127127
);
128128
$blacklistItems = [];
129129
foreach (glob($blacklistFiles) as $fileName) {
130-
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
131-
$blacklistItems = array_merge(
132-
$blacklistItems,
133-
file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
134-
);
130+
$blacklistItems[] = file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
135131
}
132+
$blacklistItems = array_merge([], ...$blacklistItems);
136133
$this->pluginBlacklist = $blacklistItems;
137134
}
138135
return $this->pluginBlacklist;
@@ -244,11 +241,10 @@ protected function _phpClassesDataProvider()
244241
$allowedFiles = array_keys($classes);
245242
foreach ($classes as $class) {
246243
if (!in_array($class, $output)) {
247-
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
248-
$output = array_merge($output, $this->_buildInheritanceHierarchyTree($class, $allowedFiles));
249-
$output = array_unique($output);
244+
$output[] = $this->_buildInheritanceHierarchyTree($class, $allowedFiles);
250245
}
251246
}
247+
$output = array_unique(array_merge([], ...$output));
252248

253249
/** Convert data into data provider format */
254250
$outputClasses = [];

dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ private function checkSetExtensionAttributes(
135135
} else {
136136
// Get the parameter name via a regular expression capture because the class may
137137
// not exist which causes a fatal error
138-
preg_match('/\[\s\<\w+?>\s([?]?[\w]+)/s', $methodParameters[0]->__toString(), $matches);
138+
preg_match('/\[\s\<\w+?>\s([?]?[\w\\\]+)/s', $methodParameters[0]->__toString(), $matches);
139139
$isCorrectParameter = false;
140-
if (isset($matches[1]) && '\\' . $matches[1] != $extensionInterfaceName) {
140+
if (isset($matches[1])
141+
&& ('\\' . ltrim($matches[1], '?')) === $extensionInterfaceName) {
141142
$isCorrectParameter = true;
142143
}
143144

0 commit comments

Comments
 (0)