|
25 | 25 | use function rmdir;
|
26 | 26 | use function sha1;
|
27 | 27 | use function sprintf;
|
28 |
| -use function str_contains; |
29 | 28 | use function str_starts_with;
|
30 | 29 | use function strlen;
|
31 | 30 | use function substr;
|
|
37 | 36 | final class FileCacheStorage implements CacheStorage
|
38 | 37 | {
|
39 | 38 |
|
40 |
| - private const CACHED_CLEARED_VERSION = 'v2-old-two'; |
| 39 | + private const CACHED_CLEARED_VERSION = 'v2-new'; |
41 | 40 |
|
42 | 41 | public function __construct(private string $directory)
|
43 | 42 | {
|
@@ -147,27 +146,16 @@ public function clearUnusedFiles(): void
|
147 | 146 | "<?php declare(strict_types = 1);\n\n%s",
|
148 | 147 | sprintf('// %s', 'variadic-method-'),
|
149 | 148 | );
|
150 |
| - $beginOld = sprintf( |
151 |
| - "<?php declare(strict_types = 1);\n\n%s", |
152 |
| - 'return PHPStan\\Cache\\CacheItem::', |
153 |
| - ); |
154 |
| - $beginOld2 = sprintf( |
155 |
| - "<?php declare(strict_types = 1);\n\n%s", |
156 |
| - 'return \\PHPStan\\Cache\\CacheItem::', |
157 |
| - ); |
| 149 | + $beginNew = "<?php declare(strict_types = 1);\n\n//"; |
158 | 150 | $emptyDirectoriesToCheck = [];
|
159 | 151 | foreach ($files as $file) {
|
160 | 152 | try {
|
161 | 153 | $path = $file->getPathname();
|
162 | 154 | $contents = FileReader::read($path);
|
163 |
| - if (str_contains($contents, 'odsl-')) { |
164 |
| - continue; |
165 |
| - } |
166 | 155 | if (
|
167 | 156 | !str_starts_with($contents, $beginFunction)
|
168 | 157 | && !str_starts_with($contents, $beginMethod)
|
169 |
| - && !str_starts_with($contents, $beginOld) |
170 |
| - && !str_starts_with($contents, $beginOld2) |
| 158 | + && str_starts_with($contents, $beginNew) |
171 | 159 | ) {
|
172 | 160 | continue;
|
173 | 161 | }
|
|
0 commit comments