22
33namespace PHPStan \Analyser \Ignore ;
44
5+ use PHPStan \Analyser \AnalysedFilesResolver ;
56use PHPStan \Analyser \Error ;
67use PHPStan \File \FileHelper ;
78use PHPStan \ShouldNotHappenException ;
8- use function array_fill_keys ;
9- use function array_key_exists ;
109use function array_values ;
1110use function count ;
1211use function is_array ;
@@ -43,12 +42,11 @@ public function getErrors(): array
4342
4443 /**
4544 * @param Error[] $errors
46- * @param string[] $analysedFiles
4745 */
4846 public function process (
4947 array $ errors ,
5048 bool $ onlyFiles ,
51- array $ analysedFiles ,
49+ AnalysedFilesResolver $ analysedFilesResolver ,
5250 bool $ hasInternalErrors ,
5351 ): IgnoredErrorHelperProcessedResult
5452 {
@@ -190,8 +188,6 @@ public function process(
190188 ), $ unmatchedIgnoredError ['file ' ], $ unmatchedIgnoredError ['line ' ], false ))->withIdentifier ('ignore.count ' );
191189 }
192190
193- $ analysedFilesKeys = array_fill_keys ($ analysedFiles , true );
194-
195191 if (!$ hasInternalErrors ) {
196192 foreach ($ unmatchedIgnoredErrors as $ unmatchedIgnoredError ) {
197193 $ reportUnmatched = $ unmatchedIgnoredError ['reportUnmatched ' ] ?? $ this ->reportUnmatchedIgnoredErrors ;
@@ -214,7 +210,8 @@ public function process(
214210 ), $ unmatchedIgnoredError ['file ' ], $ unmatchedIgnoredError ['line ' ], false ))->withIdentifier ('ignore.count ' );
215211 }
216212 } elseif (isset ($ unmatchedIgnoredError ['realPath ' ])) {
217- if (!array_key_exists ($ unmatchedIgnoredError ['realPath ' ], $ analysedFilesKeys )) {
213+
214+ if (!$ analysedFilesResolver ->isInAnalyzedFiles ($ unmatchedIgnoredError ['realPath ' ])) {
218215 continue ;
219216 }
220217
0 commit comments