File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 2121 */
2222final class CachingFileAnalyser implements FileAnalyser
2323{
24- private const CACHE_FORMAT_VERSION = 3 ;
24+ private const CACHE_FORMAT_VERSION = 2 ;
2525
2626 /**
2727 * @var FileAnalyser
@@ -106,17 +106,14 @@ public function ignoredLinesFor(string $filename): array
106106 public function process (string $ filename ): void
107107 {
108108 $ cache = $ this ->read ($ filename );
109- $ hash = crc32 (file_get_contents ($ filename ));
110109
111- if ($ cache !== false &&
112- $ hash === $ cache ['hash ' ]) {
110+ if ($ cache !== false ) {
113111 $ this ->cache [$ filename ] = $ cache ;
114112
115113 return ;
116114 }
117115
118116 $ this ->cache [$ filename ] = [
119- 'hash ' => $ hash ,
120117 'classesIn ' => $ this ->analyser ->classesIn ($ filename ),
121118 'traitsIn ' => $ this ->analyser ->traitsIn ($ filename ),
122119 'functionsIn ' => $ this ->analyser ->functionsIn ($ filename ),
@@ -160,6 +157,6 @@ private function write(string $filename, $data): void
160157
161158 private function cacheFile (string $ filename ): string
162159 {
163- return $ this ->directory . DIRECTORY_SEPARATOR . hash ('sha256 ' , $ filename . self ::CACHE_FORMAT_VERSION );
160+ return $ this ->directory . DIRECTORY_SEPARATOR . hash ('sha256 ' , $ filename . crc32 ( file_get_contents ( $ filename )) . self ::CACHE_FORMAT_VERSION );
164161 }
165162}
You can’t perform that action at this time.
0 commit comments