Skip to content

Commit 663e241

Browse files
committed
AC-3483:: SVC false-positive: modifying system.xml file from another module
1 parent 3ff6933 commit 663e241

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Analyzer/SystemXml/Analyzer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Magento\SemanticVersionChecker\Registry\XmlRegistry;
2626
use PHPSemVerChecker\Registry\Registry;
2727
use PHPSemVerChecker\Report\Report;
28-
use Magento\SemanticVersionChecker\Operation\SystemXml\FieldDuplicated;
28+
use Magento\SemanticVersionChecker\Operation\SystemXml\DuplicateFieldAdded;
2929
use RecursiveDirectoryIterator;
3030

3131
/**
@@ -153,7 +153,7 @@ private function getBaseDir($filePath)
153153
* @param string $excludeFile The file to exclude from the search.
154154
* @return array An array of paths to system.xml files, excluding the specified file.
155155
*/
156-
private function searchSystemXmlFiles($magentoBaseDir, $excludeFile = null)
156+
private function getSystemXmlFiles($magentoBaseDir, $excludeFile = null)
157157
{
158158
$systemXmlFiles = [];
159159
$directoryToSearch = [
@@ -305,7 +305,7 @@ private function reportDuplicateNodes(string $file, array $nodes)
305305
foreach ($nodes as $node) {
306306
switch (true) {
307307
case $node instanceof Field:
308-
$this->report->add('system', new FieldDuplicated($file, $node->getPath()));
308+
$this->report->add('system', new DuplicateFieldAdded($file, $node->getPath()));
309309
break;
310310
default:
311311
}
@@ -363,8 +363,9 @@ private function reportRemovedNodes(string $file, array $nodes)
363363
private function isDuplicatedFieldInXml(?string $baseDir, string $sectionId, string $groupId, ?string $fieldId, string $afterFile): array
364364
{
365365
$hasDuplicate = false;
366+
366367
if ($baseDir) {
367-
$systemXmlFiles = $this->searchSystemXmlFiles($baseDir, $afterFile);
368+
$systemXmlFiles = $this->getSystemXmlFiles($baseDir, $afterFile);
368369

369370
$result = [];
370371

src/Operation/SystemXml/FieldDuplicated.php renamed to src/Operation/SystemXml/DuplicateFieldAdded.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* When a <kbd>field</kbd> node is added.
1717
*/
18-
class FieldDuplicated extends AbstractOperation
18+
class DuplicateFieldAdded extends AbstractOperation
1919
{
2020
/**
2121
* @var string

0 commit comments

Comments
 (0)