diff --git a/.phive/phars.xml b/.phive/phars.xml index 79dc88f9b..4b7192e14 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/ChangeLog-11.0.md b/ChangeLog-11.0.md index c8df0891d..2c130b3ce 100644 --- a/ChangeLog-11.0.md +++ b/ChangeLog-11.0.md @@ -6,6 +6,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt ### Changed +* Changed version identifier for static analysis cache from "MD5 over source code" to `Version::id()` * The `SebastianBergmann\CodeCoverage\Filter::includeUncoveredFiles()` and `SebastianBergmann\CodeCoverage\Filter::excludeUncoveredFiles()` methods are no longer deprecated ## [11.0.8] - 2024-12-11 diff --git a/src/StaticAnalysis/CachingFileAnalyser.php b/src/StaticAnalysis/CachingFileAnalyser.php index 9390b2c16..cbcb3fbd1 100644 --- a/src/StaticAnalysis/CachingFileAnalyser.php +++ b/src/StaticAnalysis/CachingFileAnalyser.php @@ -18,7 +18,7 @@ use function serialize; use function unserialize; use SebastianBergmann\CodeCoverage\Util\Filesystem; -use SebastianBergmann\FileIterator\Facade as FileIteratorFacade; +use SebastianBergmann\CodeCoverage\Version; /** * @internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage @@ -32,7 +32,6 @@ */ final class CachingFileAnalyser implements FileAnalyser { - private static ?string $cacheVersion = null; private readonly string $directory; private readonly FileAnalyser $analyser; private readonly bool $useAnnotationsForIgnoringCode; @@ -173,7 +172,7 @@ private function cacheFile(string $filename): string [ $filename, file_get_contents($filename), - self::cacheVersion(), + Version::id(), $this->useAnnotationsForIgnoringCode, $this->ignoreDeprecatedCode, ], @@ -182,22 +181,4 @@ private function cacheFile(string $filename): string return $this->directory . DIRECTORY_SEPARATOR . $cacheKey; } - - private static function cacheVersion(): string - { - if (self::$cacheVersion !== null) { - return self::$cacheVersion; - } - - $buffer = []; - - foreach ((new FileIteratorFacade)->getFilesAsArray(__DIR__, '.php') as $file) { - $buffer[] = $file; - $buffer[] = file_get_contents($file); - } - - self::$cacheVersion = md5(implode("\0", $buffer)); - - return self::$cacheVersion; - } } diff --git a/tools/composer b/tools/composer index b59d7e106..4fa512267 100755 Binary files a/tools/composer and b/tools/composer differ diff --git a/tools/php-cs-fixer b/tools/php-cs-fixer index 2aea84214..2d60bdf3f 100755 Binary files a/tools/php-cs-fixer and b/tools/php-cs-fixer differ diff --git a/tools/phpstan b/tools/phpstan index 293c4441c..bdc205831 100755 Binary files a/tools/phpstan and b/tools/phpstan differ