@@ -114,6 +114,7 @@ public function analyze($registryBefore, $registryAfter)
114114
115115 // Call function to check if this field is duplicated in other system.xml files
116116 $ isDuplicated = $ this ->isDuplicatedFieldInXml ($ baseDir , $ sectionId , $ groupId , $ fieldId , $ afterFile );
117+
117118 foreach ($ isDuplicated as $ isDuplicatedItem ) {
118119 if ($ isDuplicatedItem ['status ' ] === 'duplicate ' ) {
119120 $ this ->reportDuplicateNodes ($ afterFile , [$ nodeId => $ node ]);
@@ -197,7 +198,6 @@ private function extractSectionGroupField($nodePath)
197198 $ groupId = $ parts [1 ];
198199 $ fieldId = $ parts [2 ];
199200
200-
201201 return [$ sectionId , $ groupId , $ fieldId ];
202202 }
203203
@@ -307,7 +307,6 @@ private function reportDuplicateNodes(string $file, array $nodes)
307307 case $ node instanceof Field:
308308 $ this ->report ->add ('system ' , new DuplicateFieldAdded ($ file , $ node ->getPath ()));
309309 break ;
310- default :
311310 }
312311 }
313312 }
@@ -364,11 +363,14 @@ private function isDuplicatedFieldInXml(?string $baseDir, string $sectionId, str
364363 {
365364 $ hasDuplicate = false ;
366365
366+ $ result = [
367+ 'status ' => 'minor ' ,
368+ 'field ' => $ fieldId
369+ ];
370+
367371 if ($ baseDir ) {
368372 $ systemXmlFiles = $ this ->getSystemXmlFiles ($ baseDir , $ afterFile );
369373
370- $ result = [];
371-
372374 foreach ($ systemXmlFiles as $ systemXmlFile ) {
373375 $ xmlContent = file_get_contents ($ systemXmlFile );
374376 try {
@@ -385,17 +387,15 @@ private function isDuplicatedFieldInXml(?string $baseDir, string $sectionId, str
385387 }
386388 }
387389 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+ ]
396396 ];
397397 }
398398 }
399- return $ result ;
399+ return [ $ result] ;
400400 }
401401}
0 commit comments