Skip to content

Commit b570410

Browse files
committed
ResultCacheManager: fix meta key difference for projectConfig
1 parent 19df9a2 commit b570410

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/Analyser/ResultCache/ResultCacheManager.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,27 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
312312
}
313313

314314
/**
315-
* @param mixed[] $cachedMeta
316-
* @param mixed[] $currentMeta
315+
* @param mixed[]|null $projectConfig
317316
*/
318-
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
317+
private function normalizeMetaProjectConfig(?array $projectConfig): ?string
319318
{
320-
$projectConfig = $currentMeta['projectConfig'];
321319
if ($projectConfig !== null) {
322-
ksort($currentMeta['projectConfig']);
320+
ksort($projectConfig);
323321

324-
$currentMeta['projectConfig'] = Neon::encode($currentMeta['projectConfig']);
322+
return Neon::encode($projectConfig);
325323
}
326324

325+
return null;
326+
}
327+
328+
/**
329+
* @param mixed[] $cachedMeta
330+
* @param mixed[] $currentMeta
331+
*/
332+
private function isMetaDifferent(array $cachedMeta, array $currentMeta): bool
333+
{
334+
$currentMeta['projectConfig'] = $this->normalizeMetaProjectConfig($currentMeta['projectConfig']);
335+
327336
return $cachedMeta !== $currentMeta;
328337
}
329338

@@ -337,6 +346,10 @@ private function getMetaKeyDifferences(array $cachedMeta, array $currentMeta): a
337346
{
338347
$diffs = [];
339348
foreach ($cachedMeta as $key => $value) {
349+
if ($key === 'projectConfig') {
350+
$value = $this->normalizeMetaProjectConfig($value);
351+
}
352+
340353
if (!array_key_exists($key, $currentMeta)) {
341354
$diffs[] = $key;
342355
continue;

0 commit comments

Comments
 (0)