1313
1414final class ReflectionCache
1515{
16- public const SCHEMA_VERSION = 'v9-put-null-when-valid ' ;
16+ public const SCHEMA_VERSION = 'v10-rework-replay ' ;
1717
1818 /**
1919 * @var string
@@ -174,11 +174,6 @@ public function persist(): void
174174 return ;
175175 }
176176
177- if ($ this ->isPHPStormSingleFileRun ()) {
178- // don't overwrite reflection cache, when analyzing only a single file
179- return ;
180- }
181-
182177 try {
183178 flock (self ::$ lockHandle , LOCK_EX );
184179
@@ -253,7 +248,7 @@ public function getValidationError(string $queryString): ?Error
253248 return $ cacheEntry ['error ' ];
254249 }
255250
256- public function putValidationError (string $ queryString , ? Error $ error ): void
251+ public function putValidationError (string $ queryString , Error $ error ): void
257252 {
258253 $ records = $ this ->lazyReadRecords ();
259254
@@ -266,6 +261,8 @@ public function putValidationError(string $queryString, ?Error $error): void
266261 $ this ->changes [$ queryString ]['error ' ] = $ this ->records [$ queryString ]['error ' ] = $ error ;
267262 $ this ->cacheIsDirty = true ;
268263 }
264+
265+ unset($ this ->records [$ queryString ]['result ' ]);
269266 }
270267
271268 /**
@@ -315,7 +312,7 @@ public function getResultType(string $queryString, int $fetchType): ?Type
315312 /**
316313 * @param QueryReflector::FETCH_TYPE* $fetchType
317314 */
318- public function putResultType (string $ queryString , int $ fetchType , ? Type $ resultType ): void
315+ public function putResultType (string $ queryString , int $ fetchType , Type $ resultType ): void
319316 {
320317 $ records = $ this ->lazyReadRecords ();
321318
@@ -334,14 +331,7 @@ public function putResultType(string $queryString, int $fetchType, ?Type $result
334331 $ this ->changes [$ queryString ]['result ' ][$ fetchType ] = $ this ->records [$ queryString ]['result ' ][$ fetchType ] = $ resultType ;
335332 $ this ->cacheIsDirty = true ;
336333 }
337- }
338-
339- private function isPHPStormSingleFileRun (): bool
340- {
341- if (!\array_key_exists ('__CFBundleIdentifier ' , $ _SERVER )) {
342- return false ;
343- }
344334
345- return ' com.jetbrains.PhpStorm ' === $ _SERVER [ ' __CFBundleIdentifier ' ] ;
335+ unset( $ this -> records [ $ queryString ][ ' error ' ]) ;
346336 }
347337}
0 commit comments