49
49
50
50
/**
51
51
* @phpstan-import-type LinesToIgnore from FileAnalyserResult
52
+ * @phpstan-import-type CollectorData from CollectedData
52
53
*/
53
54
final class ResultCacheManager
54
55
{
@@ -406,10 +407,7 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
406
407
$ freshLocallyIgnoredErrorsByFile [$ error ->getFilePath ()][] = $ error ;
407
408
}
408
409
409
- $ freshCollectedDataByFile = [];
410
- foreach ($ analyserResult ->getCollectedData () as $ collectedData ) {
411
- $ freshCollectedDataByFile [$ collectedData ->getFilePath ()][] = $ collectedData ;
412
- }
410
+ $ freshCollectedDataByFile = $ analyserResult ->getCollectedData ();
413
411
414
412
$ meta = $ resultCache ->getMeta ();
415
413
$ projectConfigArray = $ meta ['projectConfig ' ];
@@ -524,13 +522,6 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
524
522
}
525
523
}
526
524
527
- $ flatCollectedData = [];
528
- foreach ($ collectedDataByFile as $ fileCollectedData ) {
529
- foreach ($ fileCollectedData as $ collectedData ) {
530
- $ flatCollectedData [] = $ collectedData ;
531
- }
532
- }
533
-
534
525
return new ResultCacheProcessResult (new AnalyserResult (
535
526
$ flatErrors ,
536
527
$ analyserResult ->getFilteredPhpErrors (),
@@ -539,7 +530,7 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
539
530
$ linesToIgnore ,
540
531
$ unmatchedLineIgnores ,
541
532
$ internalErrors ,
542
- $ flatCollectedData ,
533
+ $ collectedDataByFile ,
543
534
$ dependencies ,
544
535
$ exportedNodes ,
545
536
$ analyserResult ->hasReachedInternalErrorsCountLimit (),
@@ -584,8 +575,8 @@ private function mergeLocallyIgnoredErrors(ResultCache $resultCache, array $fres
584
575
}
585
576
586
577
/**
587
- * @param array<string, array<CollectedData>> $freshCollectedDataByFile
588
- * @return array<string, array<CollectedData>>
578
+ * @param CollectorData $freshCollectedDataByFile
579
+ * @return CollectorData
589
580
*/
590
581
private function mergeCollectedData (ResultCache $ resultCache , array $ freshCollectedDataByFile ): array
591
582
{
@@ -704,7 +695,7 @@ private function mergeUnmatchedLineIgnores(ResultCache $resultCache, array $fres
704
695
* @param array<string, list<Error>> $locallyIgnoredErrors
705
696
* @param array<string, LinesToIgnore> $linesToIgnore
706
697
* @param array<string, LinesToIgnore> $unmatchedLineIgnores
707
- * @param array<string, array<CollectedData>> $collectedData
698
+ * @param array<string, array<string, list< CollectedData> >> $collectedData
708
699
* @param array<string, array<string>> $dependencies
709
700
* @param array<string, array<RootExportedNode>> $exportedNodes
710
701
* @param array<string, array{string, bool, string}> $projectExtensionFiles
@@ -760,6 +751,10 @@ private function save(
760
751
ksort ($ collectedData );
761
752
ksort ($ invertedDependencies );
762
753
754
+ foreach ($ collectedData as & $ collectedDataPerFile ) {
755
+ ksort ($ collectedDataPerFile );
756
+ }
757
+
763
758
foreach ($ invertedDependencies as $ file => $ fileData ) {
764
759
$ dependentFiles = $ fileData ['dependentFiles ' ];
765
760
sort ($ dependentFiles );
0 commit comments