@@ -114,6 +114,7 @@ public function analyze($registryBefore, $registryAfter)
114
114
115
115
// Call function to check if this field is duplicated in other system.xml files
116
116
$ isDuplicated = $ this ->isDuplicatedFieldInXml ($ baseDir , $ sectionId , $ groupId , $ fieldId , $ afterFile );
117
+
117
118
foreach ($ isDuplicated as $ isDuplicatedItem ) {
118
119
if ($ isDuplicatedItem ['status ' ] === 'duplicate ' ) {
119
120
$ this ->reportDuplicateNodes ($ afterFile , [$ nodeId => $ node ]);
@@ -197,7 +198,6 @@ private function extractSectionGroupField($nodePath)
197
198
$ groupId = $ parts [1 ];
198
199
$ fieldId = $ parts [2 ];
199
200
200
-
201
201
return [$ sectionId , $ groupId , $ fieldId ];
202
202
}
203
203
@@ -307,7 +307,6 @@ private function reportDuplicateNodes(string $file, array $nodes)
307
307
case $ node instanceof Field:
308
308
$ this ->report ->add ('system ' , new DuplicateFieldAdded ($ file , $ node ->getPath ()));
309
309
break ;
310
- default :
311
310
}
312
311
}
313
312
}
@@ -364,11 +363,14 @@ private function isDuplicatedFieldInXml(?string $baseDir, string $sectionId, str
364
363
{
365
364
$ hasDuplicate = false ;
366
365
366
+ $ result = [
367
+ 'status ' => 'minor ' ,
368
+ 'field ' => $ fieldId
369
+ ];
370
+
367
371
if ($ baseDir ) {
368
372
$ systemXmlFiles = $ this ->getSystemXmlFiles ($ baseDir , $ afterFile );
369
373
370
- $ result = [];
371
-
372
374
foreach ($ systemXmlFiles as $ systemXmlFile ) {
373
375
$ xmlContent = file_get_contents ($ systemXmlFile );
374
376
try {
@@ -385,17 +387,15 @@ private function isDuplicatedFieldInXml(?string $baseDir, string $sectionId, str
385
387
}
386
388
}
387
389
if ($ hasDuplicate ) {
388
- $ result [] = [
389
- 'status ' => 'duplicate ' ,
390
- 'field ' => $ fieldId
391
- ];
392
- } else {
393
- $ result [] = [
394
- 'status ' => 'minor ' ,
395
- 'field ' => $ fieldId
390
+ return [
391
+ [
392
+ 'status ' => 'duplicate ' ,
393
+ 'field ' => $ fieldId
394
+
395
+ ]
396
396
];
397
397
}
398
398
}
399
- return $ result ;
399
+ return [ $ result] ;
400
400
}
401
401
}
0 commit comments