1818use function serialize ;
1919use function unserialize ;
2020use SebastianBergmann \CodeCoverage \Util \Filesystem ;
21- use SebastianBergmann \FileIterator \ Facade as FileIteratorFacade ;
21+ use SebastianBergmann \CodeCoverage \ Version ;
2222
2323/**
2424 * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage
3737 */
3838final class CachingFileAnalyser implements FileAnalyser
3939{
40- private static ?string $ cacheVersion = null ;
4140 private readonly string $ directory ;
4241 private readonly FileAnalyser $ analyser ;
4342 private readonly bool $ useAnnotationsForIgnoringCode ;
@@ -207,7 +206,7 @@ private function cacheFile(string $filename): string
207206 [
208207 $ filename ,
209208 file_get_contents ($ filename ),
210- self :: cacheVersion (),
209+ Version:: id (),
211210 $ this ->useAnnotationsForIgnoringCode ,
212211 $ this ->ignoreDeprecatedCode ,
213212 ],
@@ -216,22 +215,4 @@ private function cacheFile(string $filename): string
216215
217216 return $ this ->directory . DIRECTORY_SEPARATOR . $ cacheKey ;
218217 }
219-
220- private static function cacheVersion (): string
221- {
222- if (self ::$ cacheVersion !== null ) {
223- return self ::$ cacheVersion ;
224- }
225-
226- $ buffer = [];
227-
228- foreach ((new FileIteratorFacade )->getFilesAsArray (__DIR__ , '.php ' ) as $ file ) {
229- $ buffer [] = $ file ;
230- $ buffer [] = file_get_contents ($ file );
231- }
232-
233- self ::$ cacheVersion = md5 (implode ("\0" , $ buffer ));
234-
235- return self ::$ cacheVersion ;
236- }
237218}
0 commit comments